From d2b26ac8a01539dd3b729698955f4f064cd052d5 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 16 Mar 2022 14:04:07 +0100 Subject: [PATCH] podman create: building local pause image: do not read ignore files 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: #13529 Signed-off-by: Valentin Rothberg --- pkg/specgen/generate/pod_create.go | 1 + test/system/010-images.bats | 3 +-- test/system/070-build.bats | 11 ++++++++++- test/system/200-pod.bats | 8 +------- test/system/helpers.bash | 9 +++++++++ 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index 68fda3ad7d..279507f4c3 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -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 { diff --git a/test/system/010-images.bats b/test/system/010-images.bats index ebd71450fa..dbf4b28287 100644 --- a/test/system/010-images.bats +++ b/test/system/010-images.bats @@ -248,8 +248,7 @@ Labels.created_at | 20[0-9-]\\\+T[0-9:]\\\+Z run_podman inspect --format '{{.ID}}' $IMAGE imageID=$output - run_podman version --format "{{.Server.Version}}-{{.Server.Built}}" - pauseImage=localhost/podman-pause:$output + pauseImage=$(pause_image) run_podman inspect --format '{{.ID}}' $pauseImage pauseID=$output diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 94256b2159..e7c4b5b6ff 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -607,7 +607,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 '*'" { @@ -622,6 +622,15 @@ cat >$tmpdir/.dockerignore </dev/null + echo "localhost/podman-pause:$output" +} + ########################### # _add_label_if_missing # make sure skip messages include rootless/remote ###########################