Fix the --pull flag to podman build to match Docker

The behavior should be as follows: Unset, pull if missing by
default, obey the `--pull-never` and `--pull-always` flags. Set
to false, pull never. Set to true, pull always.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2020-10-29 14:29:48 -04:00
parent 222d8075ab
commit 5180ec985d

View File

@ -241,8 +241,12 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil
} }
pullPolicy := imagebuildah.PullIfNewer pullPolicy := imagebuildah.PullIfNewer
if c.Flags().Changed("pull") && !flags.Pull { if c.Flags().Changed("pull") {
pullPolicy = imagebuildah.PullIfMissing if flags.Pull {
pullPolicy = imagebuildah.PullAlways
} else {
pullPolicy = imagebuildah.PullNever
}
} }
if flags.PullAlways { if flags.PullAlways {
pullPolicy = imagebuildah.PullAlways pullPolicy = imagebuildah.PullAlways