From 0154f9e9b3d158dce901c9f19261714660a2f27b Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 8 Dec 2020 16:26:51 -0500 Subject: Honor the --layers flag Currently the --layers flag set by the user is ignored, and only the BUILDAH_LAYERS environment variable being set is observed. Fixes: https://github.com/containers/podman/issues/8643 Signed-off-by: Daniel J Walsh --- cmd/podman/images/build.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index 739e1c265..beb994f10 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -115,6 +115,7 @@ func buildFlags(cmd *cobra.Command) { // --layers flag flag = layerFlags.Lookup("layers") useLayersVal := useLayers() + buildOpts.Layers = useLayersVal == "true" if err := flag.Value.Set(useLayersVal); err != nil { logrus.Errorf("unable to set --layers to %v: %v", useLayersVal, err) } @@ -274,11 +275,7 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil } } } - // Check to see if the BUILDAH_LAYERS environment variable is set and - // override command-line. - if _, ok := os.LookupEnv("BUILDAH_LAYERS"); ok { - flags.Layers = true - } + flags.Layers = buildOpts.Layers // `buildah bud --layers=false` acts like `docker build --squash` does. // That is all of the new layers created during the build process are -- cgit v1.2.3-54-g00ecf