mirror of
https://github.com/containers/podman.git
synced 2025-06-22 01:48:54 +08:00
Merge pull request #9127 from vrothberg/fix-9111
podman build --pull: use correct policy
This commit is contained in:
@ -266,7 +266,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
|
|||||||
|
|
||||||
pullPolicy := imagebuildah.PullIfMissing
|
pullPolicy := imagebuildah.PullIfMissing
|
||||||
if c.Flags().Changed("pull") && flags.Pull {
|
if c.Flags().Changed("pull") && flags.Pull {
|
||||||
pullPolicy = imagebuildah.PullAlways
|
pullPolicy = imagebuildah.PullIfNewer
|
||||||
}
|
}
|
||||||
if flags.PullAlways {
|
if flags.PullAlways {
|
||||||
pullPolicy = imagebuildah.PullAlways
|
pullPolicy = imagebuildah.PullAlways
|
||||||
|
@ -29,6 +29,29 @@ EOF
|
|||||||
run_podman rmi -f build_test
|
run_podman rmi -f build_test
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "podman build - basic test with --pull" {
|
||||||
|
rand_filename=$(random_string 20)
|
||||||
|
rand_content=$(random_string 50)
|
||||||
|
|
||||||
|
run_podman tag $IMAGE localhost/localonly
|
||||||
|
|
||||||
|
tmpdir=$PODMAN_TMPDIR/build-test
|
||||||
|
mkdir -p $tmpdir
|
||||||
|
dockerfile=$tmpdir/Dockerfile
|
||||||
|
cat >$dockerfile <<EOF
|
||||||
|
FROM localhost/localonly
|
||||||
|
RUN echo $rand_content > /$rand_filename
|
||||||
|
EOF
|
||||||
|
# With --pull, Podman would try to pull a newer image but use the local one
|
||||||
|
# if present. See #9111.
|
||||||
|
run_podman build --pull -t build_test $tmpdir
|
||||||
|
|
||||||
|
run_podman run --rm build_test cat /$rand_filename
|
||||||
|
is "$output" "$rand_content" "reading generated file in image"
|
||||||
|
|
||||||
|
run_podman rmi -f build_test localhost/localonly
|
||||||
|
}
|
||||||
|
|
||||||
@test "podman build - global runtime flags test" {
|
@test "podman build - global runtime flags test" {
|
||||||
skip_if_remote "--runtime-flag flag not supported for remote"
|
skip_if_remote "--runtime-flag flag not supported for remote"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user