Skip to content

Commit

Permalink
podman create: building local pause image: do not read ignore files
Browse files Browse the repository at this point in the history
Make sure to ignore local {container,docker}ignore files when building a
local pause image.  Otherwise, we may mistakenly not be able to copy
catatonit into the build container.

Fixes: containers#13529
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
  • Loading branch information
vrothberg committed Mar 16, 2022
1 parent fa33f35 commit 89b193b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pkg/specgen/generate/pod_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ENTRYPOINT ["/catatonit", "-P"]`, catatonitPath)
CommonBuildOpts: &buildahDefine.CommonBuildOptions{},
Output: imageName,
Quiet: true,
IgnoreFile: "/dev/null", // makes sure to not read a local .ignorefile (see #13529)
IIDFile: "/dev/null", // prevents Buildah from writing the ID on stdout
}
if _, _, err := rt.Build(context.Background(), buildOptions, tmpF.Name()); err != nil {
Expand Down
6 changes: 5 additions & 1 deletion test/system/070-build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ EOF
done
}

# Regression test for #9867
# Regression test for #9867 and #13529
# Make sure that if you exclude everything in context dir, that
# the Containerfile/Dockerfile in the context dir are used
@test "podman build with ignore '*'" {
Expand All @@ -620,6 +620,10 @@ cat >$tmpdir/.dockerignore <<EOF
*
EOF

# Make sure that building a local pause image ignores ignore-files (#13529)
run_podman pod create
run_podman pod rm $output

run_podman build -t build_test $tmpdir

# Rename Containerfile to Dockerfile
Expand Down

0 comments on commit 89b193b

Please sign in to comment.