From d92650a922fa82852d6f3310eff24e6b8a93fb03 Mon Sep 17 00:00:00 2001 From: baude Date: Thu, 6 Sep 2018 16:10:06 -0500 Subject: use layer cache when building images to more closely mimic docker default behavior, the --layers cli option is set to true by default for podman. the buildah environment variable of BUILDAH_LAYERS is still honored and will override the command line input. this should be considered in place of PR #1383. Many thanks for Scott McCarty for inspiring this welcome change. Signed-off-by: baude Closes: #1422 Approved by: rhatdan --- .../projectatomic/buildah/pkg/cli/common.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'vendor/github.com/projectatomic/buildah/pkg/cli') diff --git a/vendor/github.com/projectatomic/buildah/pkg/cli/common.go b/vendor/github.com/projectatomic/buildah/pkg/cli/common.go index 0d035f471..a438daf6a 100644 --- a/vendor/github.com/projectatomic/buildah/pkg/cli/common.go +++ b/vendor/github.com/projectatomic/buildah/pkg/cli/common.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/opencontainers/runtime-spec/specs-go" + "github.com/pkg/errors" "github.com/projectatomic/buildah" "github.com/projectatomic/buildah/util" "github.com/urfave/cli" @@ -68,6 +69,13 @@ var ( }, } + LayerFlags = []cli.Flag{ + cli.BoolFlag{ + Name: "layers", + Usage: fmt.Sprintf("cache intermediate layers during build. Use BUILDAH_LAYERS environment variable to override. (default %t)", UseLayers()), + }, + } + BudFlags = []cli.Flag{ cli.StringSliceFlag{ Name: "annotation", @@ -129,10 +137,6 @@ var ( Name: "label", Usage: "Set metadata for an image (default [])", }, - cli.BoolFlag{ - Name: "layers", - Usage: fmt.Sprintf("cache intermediate layers during build. Use BUILDAH_LAYERS environment variable to override. (default %t)", UseLayers()), - }, cli.BoolFlag{ Name: "no-cache", Usage: "Do not use existing cached images for the container build. Build from the start with a new set of cached layers.", @@ -280,3 +284,12 @@ func DefaultIsolation() string { } return buildah.OCI } + +func VerifyFlagsArgsOrder(args []string) error { + for _, arg := range args { + if strings.HasPrefix(arg, "-") { + return errors.Errorf("No options (%s) can be specified after the image or container name", arg) + } + } + return nil +} -- cgit v1.2.3-54-g00ecf