Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman create: building local pause image: do not read ignore files #13530

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 1 addition & 2 deletions test/system/010-images.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 10 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,15 @@ cat >$tmpdir/.dockerignore <<EOF
*
EOF

# Prior to the fix for #13529, pod-create would fail with 'error building
# at STEP COPY .../catatonit' because of the local .dockerignore file was
# used.
pushd "${tmpdir}"
run_podman pod create
run_podman pod rm $output
vrothberg marked this conversation as resolved.
Show resolved Hide resolved
run_podman rmi $(pause_image)
popd

run_podman build -t build_test $tmpdir

# Rename Containerfile to Dockerfile
Expand Down
8 changes: 1 addition & 7 deletions test/system/200-pod.bats
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ load helpers
function teardown() {
run_podman pod rm -f -t 0 -a
run_podman rm -f -t 0 -a
run_podman image list --format '{{.ID}} {{.Repository}}'
while read id name; do
if [[ "$name" =~ /podman-pause ]]; then
run_podman rmi $id
fi
done <<<"$output"

run_podman ? rmi $(pause_image)
basic_teardown
}

Expand Down
9 changes: 9 additions & 0 deletions test/system/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,15 @@ function journald_unavailable() {
return 1
}

# Returns the name of the local pause image.
function pause_image() {
# This function is intended to be used as '$(pause_image)', i.e.
# our caller wants our output. run_podman() messes with output because
# it emits the command invocation to stdout, hence the redirection.
run_podman version --format "{{.Server.Version}}-{{.Server.Built}}" >/dev/null
echo "localhost/podman-pause:$output"
}

###########################
# _add_label_if_missing # make sure skip messages include rootless/remote
###########################
Expand Down