mirror of
https://github.com/containers/podman.git
synced 2025-10-26 02:35:43 +08:00
Merge pull request #9144 from vrothberg/fix-9134
Revert "podman build --pull: use correct policy"
This commit is contained in:
@ -106,7 +106,9 @@ func buildFlags(cmd *cobra.Command) {
|
|||||||
logrus.Errorf("unable to set --pull to true: %v", err)
|
logrus.Errorf("unable to set --pull to true: %v", err)
|
||||||
}
|
}
|
||||||
flag.DefValue = "true"
|
flag.DefValue = "true"
|
||||||
|
flag.Usage = "Always attempt to pull the image (errors are fatal)"
|
||||||
flags.AddFlagSet(&budFlags)
|
flags.AddFlagSet(&budFlags)
|
||||||
|
|
||||||
// Add the completion functions
|
// Add the completion functions
|
||||||
budCompletions := buildahCLI.GetBudFlagsCompletions()
|
budCompletions := buildahCLI.GetBudFlagsCompletions()
|
||||||
completion.CompleteCommandFlags(cmd, budCompletions)
|
completion.CompleteCommandFlags(cmd, budCompletions)
|
||||||
@ -266,7 +268,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.PullIfNewer
|
pullPolicy = imagebuildah.PullAlways
|
||||||
}
|
}
|
||||||
if flags.PullAlways {
|
if flags.PullAlways {
|
||||||
pullPolicy = imagebuildah.PullAlways
|
pullPolicy = imagebuildah.PullAlways
|
||||||
|
|||||||
@ -455,9 +455,8 @@ not required for Buildah as it supports only Linux.
|
|||||||
|
|
||||||
#### **--pull**
|
#### **--pull**
|
||||||
|
|
||||||
When the option is specified or set to "true", pull the image from the first
|
When the option is specified or set to "true", pull the image. Raise an error
|
||||||
registry it is found in as listed in registries.conf. Raise an error if not
|
if the image could not be pulled, even if the image is present locally.
|
||||||
found in the registries, even if the image is present locally.
|
|
||||||
|
|
||||||
If the option is disabled (with *--pull=false*) or not specified, pull the
|
If the option is disabled (with *--pull=false*) or not specified, pull the
|
||||||
image from the registry only if the image is not present locally. Raise an
|
image from the registry only if the image is not present locally. Raise an
|
||||||
|
|||||||
@ -29,29 +29,6 @@ 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