Merge pull request #6305 from openshift-cherrypick-robot/cherry-pick-6300-to-release-1.41

[release-1.41] Restore the default meaning of `--pull` (should be `always`).
This commit is contained in:
openshift-merge-bot[bot] 2025-07-31 15:01:38 +00:00 committed by GitHub
commit 1854b44a2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 15 additions and 7 deletions

View File

@ -75,7 +75,7 @@ missing: pull images if the named images are not present in store,
never: only use images present in store if available,
newer: only pull images when newer images exist on the registry than those in the store.`)
flags.Lookup("pull").NoOptDefVal = "true" // allow `--pull ` to be set to `true` as expected.
flags.Lookup("pull").NoOptDefVal = "always" // treat a --pull with no argument like --pull=always
flags.BoolVar(&opts.pullAlways, "pull-always", false, "pull the image even if the named image is present in store")
if err := flags.MarkHidden("pull-always"); err != nil {

View File

@ -794,7 +794,8 @@ The `buildah build` command allows building images for all Linux architectures,
**--pull**
Pull image policy. The default is **missing**.
Pull image policy. If not specified, the default is **missing**. If an explicit
**--pull** argument is provided without any value, use the **always** behavior.
- **always**: Pull base and SBOM scanner images from the registries listed in
registries.conf. Raise an error if a base or SBOM scanner image is not found

View File

@ -388,7 +388,8 @@ the help of emulation provided by packages like `qemu-user-static`.
**--pull**
Pull image policy. The default is **missing**.
Pull image policy. If not specified, the default is **missing**. If an explicit
**--pull** argument is provided without any value, use the **always** behavior.
- **always**: Pull base and SBOM scanner images from the registries listed in
registries.conf. Raise an error if a base or SBOM scanner image is not found

View File

@ -281,7 +281,7 @@ always: pull base and SBOM scanner images even if the named images are present
missing: pull base and SBOM scanner images if the named images are not present in store.
never: only use images present in store if available.
newer: only pull base and SBOM scanner images when newer images exist on the registry than those in the store.`)
fs.Lookup("pull").NoOptDefVal = "missing" // treat a --pull with no argument like --pull=missing
fs.Lookup("pull").NoOptDefVal = "always" // treat a --pull with no argument like --pull=always
fs.BoolVar(&flags.PullAlways, "pull-always", false, "pull the image even if the named image is present in store")
if err := fs.MarkHidden("pull-always"); err != nil {
panic(fmt.Sprintf("error marking the pull-always flag as hidden: %v", err))

View File

@ -527,9 +527,9 @@ func pullPolicyWithFlags(policySpec string, always, never bool) (define.PullPoli
}
policy := strings.ToLower(policySpec)
switch policy {
case "true", "missing", "ifmissing", "notpresent":
case "missing", "ifmissing", "notpresent":
return define.PullIfMissing, nil
case "always":
case "true", "always":
return define.PullAlways, nil
case "false", "never":
return define.PullNever, nil

View File

@ -410,6 +410,12 @@ load helpers
run_buildah inspect --format "{{.FromImageDigest}}" docker.io/busybox
fromDigest="$output"
run_buildah pull $WITH_POLICY_JSON docker.io/busybox
run_buildah from $WITH_POLICY_JSON --name busyboxc --pull docker.io/busybox
expect_output --substring "Getting"
run_buildah rm busyboxc
run_buildah from $WITH_POLICY_JSON --name busyboxc --pull=true docker.io/busybox
expect_output --substring "Getting"
run_buildah rm busyboxc
run_buildah from $WITH_POLICY_JSON --name busyboxc --pull-always docker.io/busybox
expect_output --substring "Getting"
run_buildah commit $WITH_POLICY_JSON busyboxc fakename-img

View File

@ -237,7 +237,7 @@ EOF
cid=$output
run_buildah config --entrypoint '[ "/ENTRYPOINT" ]' $cid
run_buildah commit $WITH_POLICY_JSON $cid new-image
run_buildah from --quiet --pull=true $WITH_POLICY_JSON new-image
run_buildah from --quiet $WITH_POLICY_JSON new-image
cid=$output
run_buildah config --env 'foo=bar' $cid
run_buildah commit $WITH_POLICY_JSON $cid new-image-2