Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(buildah): import with rename and include paths not working properly
Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed Sep 27, 2022
1 parent 66349fc commit 4d35fdb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
9 changes: 6 additions & 3 deletions pkg/container_backend/buildah_backend.go
Expand Up @@ -385,17 +385,20 @@ func (runtime *BuildahBackend) applyDependenciesImports(ctx context.Context, con

copyRec, err := copyrec.New(absFrom, absTo, copyrec.Options{
MatchDir: func(path string) (copyrec.DirAction, error) {
relPath := util.GetRelativeToBaseFilepath(absFrom, path)

switch {
case pathMatcher.IsPathMatched(path):
case pathMatcher.IsPathMatched(relPath):
return copyrec.DirMatch, nil
case pathMatcher.ShouldGoThrough(path):
case pathMatcher.ShouldGoThrough(relPath):
return copyrec.DirFallThrough, nil
default:
return copyrec.DirSkip, nil
}
},
MatchFile: func(path string) (bool, error) {
return pathMatcher.IsPathMatched(path), err
relPath := util.GetRelativeToBaseFilepath(absFrom, path)
return pathMatcher.IsPathMatched(relPath), err
},
UID: uid,
GID: gid,
Expand Down
14 changes: 6 additions & 8 deletions test/e2e/build/complex_test.go
Expand Up @@ -123,10 +123,9 @@ var _ = Describe("Complex build", Label("e2e", "build", "complex"), func() {
"stat -c %u:%g /basedir/file | diff <(echo 0:0) -",
"echo 'content' | diff /basedir/file -",

// TODO: fix buildah: rename during import not working
// "test -f /basedir-imported/file",
// "stat -c %u:%g /basedir-imported/file | diff <(echo 1060:1061) -",
// "echo 'content' | diff /basedir-imported/file -",
"test -f /basedir-imported/file",
"stat -c %u:%g /basedir-imported/file | diff <(echo 1060:1061) -",
"echo 'content' | diff /basedir-imported/file -",
)
}

Expand Down Expand Up @@ -214,10 +213,9 @@ var _ = Describe("Complex build", Label("e2e", "build", "complex"), func() {
"stat -c %u:%g /basedir/file | diff <(echo 0:0) -",
"echo 'content' | diff /basedir/file -",

// TODO: fix buildah: rename during import not working
// "test -f /basedir-imported/file",
// "stat -c %u:%g /basedir-imported/file | diff <(echo 1060:1061) -",
// "echo 'content' | diff /basedir-imported/file -",
"test -f /basedir-imported/file",
"stat -c %u:%g /basedir-imported/file | diff <(echo 1060:1061) -",
"echo 'content' | diff /basedir-imported/file -",
)
}
},
Expand Down

0 comments on commit 4d35fdb

Please sign in to comment.