summaryrefslogtreecommitdiff
path: root/vendor/github.com/projectatomic/buildah/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/projectatomic/buildah/pkg')
-rw-r--r--vendor/github.com/projectatomic/buildah/pkg/cli/common.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/vendor/github.com/projectatomic/buildah/pkg/cli/common.go b/vendor/github.com/projectatomic/buildah/pkg/cli/common.go
index e545e97d3..d00ebbdc5 100644
--- a/vendor/github.com/projectatomic/buildah/pkg/cli/common.go
+++ b/vendor/github.com/projectatomic/buildah/pkg/cli/common.go
@@ -5,6 +5,10 @@ package cli
// that vendor in this code can use them too.
import (
+ "fmt"
+ "os"
+ "strings"
+
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/projectatomic/buildah"
"github.com/projectatomic/buildah/util"
@@ -120,8 +124,12 @@ var (
Usage: "Set metadata for an image (default [])",
},
cli.BoolFlag{
+ Name: "layers",
+ Usage: fmt.Sprintf("cache intermediate layers during build (default %t)", UseLayers()),
+ },
+ cli.BoolFlag{
Name: "no-cache",
- Usage: "Do not use caching for the container build. The build process does not currently support caching so this is a NOOP.",
+ Usage: "Do not use existing cached images for the container build. Build from the start with a new set of cached layers.",
},
cli.StringFlag{
Name: "logfile",
@@ -230,3 +238,13 @@ var (
},
}, usernsFlags...), NamespaceFlags...)
)
+
+// UseLayers returns true if BUILDAH_LAYERS is set to "1" or "true"
+// otherwise it returns false
+func UseLayers() bool {
+ layers := os.Getenv("BUILDAH_LAYERS")
+ if strings.ToLower(layers) == "true" || layers == "1" {
+ return true
+ }
+ return false
+}