summaryrefslogtreecommitdiff
path: root/cmd/podman/images/build.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-03-26 15:44:02 -0400
committerMatthew Heon <mheon@redhat.com>2021-03-29 11:43:32 -0400
commit1089f83a40af084d4a3c0a03f2279ff3f58c2b4c (patch)
treed573f7361fda5e816d73087ceadc26d64ecc5b62 /cmd/podman/images/build.go
parentbe02c8581cd2316bddc3007171f6057c63e95eb2 (diff)
downloadpodman-1089f83a40af084d4a3c0a03f2279ff3f58c2b4c.tar.gz
podman-1089f83a40af084d4a3c0a03f2279ff3f58c2b4c.tar.bz2
podman-1089f83a40af084d4a3c0a03f2279ff3f58c2b4c.zip
Fix podman build --pull-never
Currently pull policy is set incorrectly when users set --pull-never. Also pull-policy is not being translated correctly when using podman-remote. Fixes: #9573 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> <MH: Fixed cherry-pick conflict> Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'cmd/podman/images/build.go')
-rw-r--r--cmd/podman/images/build.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go
index f24e9a8f6..7db927e55 100644
--- a/cmd/podman/images/build.go
+++ b/cmd/podman/images/build.go
@@ -304,6 +304,21 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
return nil, err
}
+ pullFlagsCount := 0
+ if c.Flag("pull").Changed {
+ pullFlagsCount++
+ }
+ if c.Flag("pull-always").Changed {
+ pullFlagsCount++
+ }
+ if c.Flag("pull-never").Changed {
+ pullFlagsCount++
+ }
+
+ if pullFlagsCount > 1 {
+ return nil, errors.Errorf("can only set one of 'pull' or 'pull-always' or 'pull-never'")
+ }
+
pullPolicy := define.PullIfMissing
if c.Flags().Changed("pull") && flags.Pull {
pullPolicy = define.PullAlways
@@ -313,7 +328,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
}
if flags.PullNever {
- pullPolicy = define.PullIfMissing
+ pullPolicy = define.PullNever
}
args := make(map[string]string)