diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2019-02-21 15:04:53 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2019-02-23 15:57:24 -0500 |
commit | bcc6b773e6c647ad6908692736b0a807bb019ba6 (patch) | |
tree | 5634def32b4836829581cc8ceca9a697a4db1fd7 /cmd/podman/build.go | |
parent | 0969d725a3b302d9baa0616a204f7fc824404973 (diff) | |
download | podman-bcc6b773e6c647ad6908692736b0a807bb019ba6.tar.gz podman-bcc6b773e6c647ad6908692736b0a807bb019ba6.tar.bz2 podman-bcc6b773e6c647ad6908692736b0a807bb019ba6.zip |
Switch defaults for podman build versus buildah
Switch defaults for --layers, --force-rm and --pull-always
from buildah to podman.
Only override default values.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/build.go')
-rw-r--r-- | cmd/podman/build.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/cmd/podman/build.go b/cmd/podman/build.go index 2054381ec..be85f4373 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -52,12 +52,22 @@ func init() { flags := buildCommand.Flags() flags.SetInterspersed(false) - flags.BoolVar(&layerValues.ForceRm, "force-rm", true, "Always remove intermediate containers after a build, even if the build is unsuccessful. (default true)") - flags.BoolVar(&layerValues.Layers, "layers", true, "Cache intermediate layers during build. Use BUILDAH_LAYERS environment variable to override") budFlags := buildahcli.GetBudFlags(&budFlagsValues) + flag := budFlags.Lookup("pull-always") + flag.Value.Set("true") + flag.DefValue = "true" + layerFlags := buildahcli.GetLayerFlags(&layerValues) + flag = layerFlags.Lookup("layers") + flag.Value.Set(useLayers()) + flag.DefValue = (useLayers()) + flag = layerFlags.Lookup("force-rm") + flag.Value.Set("true") + flag.DefValue = "true" + fromAndBugFlags := buildahcli.GetFromAndBudFlags(&fromAndBudValues, &userNSValues, &namespaceValues) flags.AddFlagSet(&budFlags) + flags.AddFlagSet(&layerFlags) flags.AddFlagSet(&fromAndBugFlags) } @@ -272,3 +282,13 @@ func Tail(a []string) []string { } return []string{} } + +// useLayers returns false if BUILDAH_LAYERS is set to "0" or "false" +// otherwise it returns true +func useLayers() string { + layers := os.Getenv("BUILDAH_LAYERS") + if strings.ToLower(layers) == "false" || layers == "0" { + return "false" + } + return "true" +} |