From eb5fdebc84e59f8645218f8fdfd6e6a8136cfa43 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 28 Aug 2018 09:39:47 -0400 Subject: Vendor in latest projectatomic/buildah This will help document the defaults in podman build. podman build --help will now show the defaults and mention the environment variables that can be set to change them. Signed-off-by: Daniel J Walsh Closes: #1364 Approved by: mheon --- cmd/podman/build.go | 13 +++---------- cmd/podman/common.go | 13 +++++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/build.go b/cmd/podman/build.go index e35fd10a4..6671c18c7 100644 --- a/cmd/podman/build.go +++ b/cmd/podman/build.go @@ -77,16 +77,9 @@ func buildCmd(c *cli.Context) error { } dockerfiles := getDockerfiles(c.StringSlice("file")) - format := "oci" - if c.IsSet("format") { - format = strings.ToLower(c.String("format")) - } - if strings.HasPrefix(format, "oci") { - format = imagebuildah.OCIv1ImageFormat - } else if strings.HasPrefix(format, "docker") { - format = imagebuildah.Dockerv2ImageFormat - } else { - return errors.Errorf("unrecognized image type %q", format) + format, err := getFormat(c) + if err != nil { + return nil } contextDir := "" cliArgs := c.Args() diff --git a/cmd/podman/common.go b/cmd/podman/common.go index d9216850f..797e74c98 100644 --- a/cmd/podman/common.go +++ b/cmd/podman/common.go @@ -10,6 +10,7 @@ import ( "github.com/containers/storage" "github.com/fatih/camelcase" "github.com/pkg/errors" + "github.com/projectatomic/buildah" "github.com/urfave/cli" ) @@ -406,3 +407,15 @@ var createFlags = []cli.Flag{ Usage: "Working `directory inside the container", }, } + +func getFormat(c *cli.Context) (string, error) { + format := strings.ToLower(c.String("format")) + if strings.HasPrefix(format, buildah.OCI) { + return buildah.OCIv1ImageManifest, nil + } + + if strings.HasPrefix(format, buildah.DOCKER) { + return buildah.Dockerv2ImageManifest, nil + } + return "", errors.Errorf("unrecognized image type %q", format) +} -- cgit v1.2.3-54-g00ecf