Skip to content

Commit

Permalink
Merge pull request #20124 from vrothberg/build-docs
Browse files Browse the repository at this point in the history
podman build: correct default pull policy
  • Loading branch information
openshift-merge-robot authored Sep 25, 2023
2 parents ca1cd02 + 59e295f commit c59d1df
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmd/podman/common/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ func DefineBuildFlags(cmd *cobra.Command, buildOpts *BuildFlagsWrapper) {

// --pull flag
flag := budFlags.Lookup("pull")
if err := flag.Value.Set("true"); err != nil {
logrus.Errorf("Unable to set --pull to true: %v", err)
flag.DefValue = "missing"
if err := flag.Value.Set("missing"); err != nil {
logrus.Errorf("Unable to set --pull to 'missing': %v", err)
}
flag.DefValue = "true"
flag.Usage = "Always attempt to pull the image (errors are fatal)"
flag.Usage = `Pull image policy ("always/true"|"missing"|"never/false"|"newer")`
flags.AddFlagSet(&budFlags)

// Add the completion functions
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-build.1.md.in
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ the help of emulation provided by packages like `qemu-user-static`.

#### **--pull**=*policy*

Pull image policy. The default is **always**.
Pull image policy. The default is **missing**.

- **always**, **true**: Always pull the image and throw an error if the pull fails.
- **missing**: Only pull the image when it does not exist in the local containers storage. Throw an error if no image is found and the pull fails.
Expand Down
4 changes: 4 additions & 0 deletions test/system/070-build.bats
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ EOF
PODMAN_TIMEOUT=240 run_podman build -t build_test --format=docker $tmpdir
is "$output" ".*COMMIT" "COMMIT seen in log"

# $IMAGE is preloaded, so we should never re-pull
assert "$output" !~ "Trying to pull" "Default pull policy should be 'missing'"
assert "$output" !~ "Writing manifest" "Default pull policy should be 'missing'"

run_podman run --rm build_test cat /$rand_filename
is "$output" "$rand_content" "reading generated file in image"

Expand Down

0 comments on commit c59d1df

Please sign in to comment.