summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-01 11:59:46 -0400
committerGitHub <noreply@github.com>2022-04-01 11:59:46 -0400
commitd4394ea3688ad1942b8457f6df869f7c440d49e7 (patch)
tree29d406009b816cdae19268ead6fd40006fa34e2a /pkg
parent23e57575b0a402d7f7de9d20571776d0512fd489 (diff)
parentf8c2df87cbb48e2e57710d8bc7d024b615235dbf (diff)
downloadpodman-d4394ea3688ad1942b8457f6df869f7c440d49e7.tar.gz
podman-d4394ea3688ad1942b8457f6df869f7c440d49e7.tar.bz2
podman-d4394ea3688ad1942b8457f6df869f7c440d49e7.zip
Merge pull request #13665 from jwhonce/issues/13535
Add build test for .containerignore tar file
Diffstat (limited to 'pkg')
-rw-r--r--pkg/bindings/images/build.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/bindings/images/build.go b/pkg/bindings/images/build.go
index f6739b7ca..ab562377f 100644
--- a/pkg/bindings/images/build.go
+++ b/pkg/bindings/images/build.go
@@ -367,20 +367,20 @@ func Build(ctx context.Context, containerFiles []string, options entities.BuildO
return nil, err
}
- // Check if Containerfile is in the context directory, if so truncate the contextdirectory off path
+ // Check if Containerfile is in the context directory, if so truncate the context directory off path
// Do NOT add to tarfile
if strings.HasPrefix(containerfile, contextDir+string(filepath.Separator)) {
containerfile = strings.TrimPrefix(containerfile, contextDir+string(filepath.Separator))
dontexcludes = append(dontexcludes, "!"+containerfile)
} else {
- // If Containerfile does not exists assume it is in context directory, do Not add to tarfile
+ // If Containerfile does not exist, assume it is in context directory and do Not add to tarfile
if _, err := os.Lstat(containerfile); err != nil {
if !os.IsNotExist(err) {
return nil, err
}
containerfile = c
} else {
- // If Containerfile does exists but is not in context directory add it to the tarfile
+ // If Containerfile does exist and not in the context directory, add it to the tarfile
tarContent = append(tarContent, containerfile)
}
}
@@ -586,6 +586,9 @@ func nTar(excludes []string, sources ...string) (io.ReadCloser, error) {
return errors.Wrapf(err, "error checking if %q is excluded", name)
}
if excluded {
+ // Note: filepath.SkipDir is not possible to use given .dockerignore semantics.
+ // An exception to exclusions may include an excluded directory, therefore we
+ // are required to visit all files. :(
return nil
}