summaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-08-28 09:39:47 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-29 14:27:11 +0000
commiteb5fdebc84e59f8645218f8fdfd6e6a8136cfa43 (patch)
treeb1625395d2cb3ca26ba85c3e418ce36edcea27af /vendor
parent6a46af571e70fd49655fe97df93391500933b2d1 (diff)
downloadpodman-eb5fdebc84e59f8645218f8fdfd6e6a8136cfa43.tar.gz
podman-eb5fdebc84e59f8645218f8fdfd6e6a8136cfa43.tar.bz2
podman-eb5fdebc84e59f8645218f8fdfd6e6a8136cfa43.zip
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 <dwalsh@redhat.com> Closes: #1364 Approved by: mheon
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/projectatomic/buildah/buildah.go4
-rw-r--r--vendor/github.com/projectatomic/buildah/common.go7
-rw-r--r--vendor/github.com/projectatomic/buildah/config.go33
-rw-r--r--vendor/github.com/projectatomic/buildah/imagebuildah/build.go11
-rw-r--r--vendor/github.com/projectatomic/buildah/new.go1
-rw-r--r--vendor/github.com/projectatomic/buildah/pkg/cli/common.go32
6 files changed, 71 insertions, 17 deletions
diff --git a/vendor/github.com/projectatomic/buildah/buildah.go b/vendor/github.com/projectatomic/buildah/buildah.go
index 32785a26f..60688b372 100644
--- a/vendor/github.com/projectatomic/buildah/buildah.go
+++ b/vendor/github.com/projectatomic/buildah/buildah.go
@@ -178,6 +178,8 @@ type Builder struct {
CommonBuildOpts *CommonBuildOptions
// TopLayer is the top layer of the image
TopLayer string
+ // Format for the build Image
+ Format string
}
// BuilderInfo are used as objects to display container information
@@ -360,6 +362,8 @@ type BuilderOptions struct {
DropCapabilities []string
CommonBuildOpts *CommonBuildOptions
+ // Format for the container image
+ Format string
}
// ImportOptions are used to initialize a Builder from an existing container
diff --git a/vendor/github.com/projectatomic/buildah/common.go b/vendor/github.com/projectatomic/buildah/common.go
index 18c960003..dcf922dc9 100644
--- a/vendor/github.com/projectatomic/buildah/common.go
+++ b/vendor/github.com/projectatomic/buildah/common.go
@@ -7,6 +7,13 @@ import (
"github.com/containers/image/types"
)
+const (
+ // OCI used to define the "oci" image format
+ OCI = "oci"
+ // DOCKER used to define the "docker" image format
+ DOCKER = "docker"
+)
+
func getCopyOptions(reportWriter io.Writer, sourceSystemContext *types.SystemContext, destinationSystemContext *types.SystemContext, manifestType string) *cp.Options {
return &cp.Options{
ReportWriter: reportWriter,
diff --git a/vendor/github.com/projectatomic/buildah/config.go b/vendor/github.com/projectatomic/buildah/config.go
index 731e3b80a..2f4d8319a 100644
--- a/vendor/github.com/projectatomic/buildah/config.go
+++ b/vendor/github.com/projectatomic/buildah/config.go
@@ -4,7 +4,6 @@ import (
"context"
"encoding/json"
"os"
- "path/filepath"
"runtime"
"strings"
"time"
@@ -12,9 +11,11 @@ import (
"github.com/containers/image/manifest"
"github.com/containers/image/transports"
"github.com/containers/image/types"
+ "github.com/containers/storage/pkg/stringid"
ociv1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
"github.com/projectatomic/buildah/docker"
+ "github.com/sirupsen/logrus"
)
// unmarshalConvertedConfig obtains the config blob of img valid for the wantedManifestMIMEType format
@@ -107,8 +108,8 @@ func (b *Builder) fixupConfig() {
if b.Architecture() == "" {
b.SetArchitecture(runtime.GOARCH)
}
- if b.WorkDir() == "" {
- b.SetWorkDir(string(filepath.Separator))
+ if b.Format == Dockerv2ImageManifest && b.Hostname() == "" {
+ b.SetHostname(stringid.TruncateID(stringid.GenerateRandomID()))
}
}
@@ -218,6 +219,9 @@ func (b *Builder) ClearOnBuild() {
// Note: this setting is not present in the OCIv1 image format, so it is
// discarded when writing images using OCIv1 formats.
func (b *Builder) SetOnBuild(onBuild string) {
+ if onBuild != "" && b.Format != Dockerv2ImageManifest {
+ logrus.Errorf("ONBUILD is not supported for OCI Image formats, %s will be ignored. Must use `docker` format", onBuild)
+ }
b.Docker.Config.OnBuild = append(b.Docker.Config.OnBuild, onBuild)
}
@@ -247,6 +251,10 @@ func (b *Builder) Shell() []string {
// Note: this setting is not present in the OCIv1 image format, so it is
// discarded when writing images using OCIv1 formats.
func (b *Builder) SetShell(shell []string) {
+ if len(shell) > 0 && b.Format != Dockerv2ImageManifest {
+ logrus.Errorf("SHELL is not supported for OCI Image format, %s will be ignored. Must use `docker` format", shell)
+ }
+
b.Docker.Config.Shell = copyStringSlice(shell)
}
@@ -327,7 +335,10 @@ func (b *Builder) SetCmd(cmd []string) {
// Entrypoint returns the command to be run for containers built from images
// built from this container.
func (b *Builder) Entrypoint() []string {
- return copyStringSlice(b.OCIv1.Config.Entrypoint)
+ if len(b.OCIv1.Config.Entrypoint) > 0 {
+ return copyStringSlice(b.OCIv1.Config.Entrypoint)
+ }
+ return nil
}
// SetEntrypoint sets the command to be run for in containers built from images
@@ -416,7 +427,10 @@ func (b *Builder) Volumes() []string {
for k := range b.OCIv1.Config.Volumes {
v = append(v, k)
}
- return v
+ if len(v) > 0 {
+ return v
+ }
+ return nil
}
// AddVolume adds a location to the image's list of locations which should be
@@ -460,6 +474,9 @@ func (b *Builder) Hostname() string {
// Note: this setting is not present in the OCIv1 image format, so it is
// discarded when writing images using OCIv1 formats.
func (b *Builder) SetHostname(name string) {
+ if name != "" && b.Format != Dockerv2ImageManifest {
+ logrus.Errorf("HOSTNAME is not supported for OCI Image format, hostname %s will be ignored. Must use `docker` format", name)
+ }
b.Docker.Config.Hostname = name
}
@@ -474,6 +491,9 @@ func (b *Builder) Domainname() string {
// Note: this setting is not present in the OCIv1 image format, so it is
// discarded when writing images using OCIv1 formats.
func (b *Builder) SetDomainname(name string) {
+ if name != "" && b.Format != Dockerv2ImageManifest {
+ logrus.Errorf("DOMAINNAME is not supported for OCI Image format, domainname %s will be ignored. Must use `docker` format", name)
+ }
b.Docker.Config.Domainname = name
}
@@ -493,6 +513,9 @@ func (b *Builder) Comment() string {
// Note: this setting is not present in the OCIv1 image format, so it is
// discarded when writing images using OCIv1 formats.
func (b *Builder) SetComment(comment string) {
+ if comment != "" && b.Format != Dockerv2ImageManifest {
+ logrus.Errorf("COMMENT is not supported for OCI Image format, comment %s will be ignored. Must use `docker` format", comment)
+ }
b.Docker.Comment = comment
}
diff --git a/vendor/github.com/projectatomic/buildah/imagebuildah/build.go b/vendor/github.com/projectatomic/buildah/imagebuildah/build.go
index 52bbe9d8c..08d0f6268 100644
--- a/vendor/github.com/projectatomic/buildah/imagebuildah/build.go
+++ b/vendor/github.com/projectatomic/buildah/imagebuildah/build.go
@@ -34,11 +34,9 @@ import (
)
const (
- PullIfMissing = buildah.PullIfMissing
- PullAlways = buildah.PullAlways
- PullNever = buildah.PullNever
- OCIv1ImageFormat = buildah.OCIv1ImageManifest
- Dockerv2ImageFormat = buildah.Dockerv2ImageManifest
+ PullIfMissing = buildah.PullIfMissing
+ PullAlways = buildah.PullAlways
+ PullNever = buildah.PullNever
Gzip = archive.Gzip
Bzip2 = archive.Bzip2
@@ -114,7 +112,7 @@ type BuildOptions struct {
ReportWriter io.Writer
// OutputFormat is the format of the output image's manifest and
// configuration data.
- // Accepted values are OCIv1ImageFormat and Dockerv2ImageFormat.
+ // Accepted values are buildah.OCIv1ImageManifest and buildah.Dockerv2ImageManifest.
OutputFormat string
// SystemContext holds parameters used for authentication.
SystemContext *types.SystemContext
@@ -640,6 +638,7 @@ func (b *Executor) Prepare(ctx context.Context, ib *imagebuilder.Builder, node *
IDMappingOptions: b.idmappingOptions,
CommonBuildOpts: b.commonBuildOptions,
DefaultMountsFilePath: b.defaultMountsFilePath,
+ Format: b.outputFormat,
}
builder, err := buildah.NewBuilder(ctx, b.store, builderOptions)
if err != nil {
diff --git a/vendor/github.com/projectatomic/buildah/new.go b/vendor/github.com/projectatomic/buildah/new.go
index 773e65427..1abb2f1f1 100644
--- a/vendor/github.com/projectatomic/buildah/new.go
+++ b/vendor/github.com/projectatomic/buildah/new.go
@@ -339,6 +339,7 @@ func newBuilder(ctx context.Context, store storage.Store, options BuilderOptions
CommonBuildOpts: options.CommonBuildOpts,
TopLayer: topLayer,
Args: options.Args,
+ Format: options.Format,
}
if options.Mount {
diff --git a/vendor/github.com/projectatomic/buildah/pkg/cli/common.go b/vendor/github.com/projectatomic/buildah/pkg/cli/common.go
index 39a1773e4..0d035f471 100644
--- a/vendor/github.com/projectatomic/buildah/pkg/cli/common.go
+++ b/vendor/github.com/projectatomic/buildah/pkg/cli/common.go
@@ -10,12 +10,12 @@ import (
"strings"
"github.com/opencontainers/runtime-spec/specs-go"
+ "github.com/projectatomic/buildah"
"github.com/projectatomic/buildah/util"
"github.com/urfave/cli"
)
var (
- runtime = util.Runtime()
usernsFlags = []cli.Flag{
cli.StringFlag{
Name: "userns",
@@ -113,7 +113,8 @@ var (
},
cli.StringFlag{
Name: "format",
- Usage: "`format` of the built image's manifest and metadata",
+ Usage: "`format` of the built image's manifest and metadata. Use BUILDAH_FORMAT environment variable to override.",
+ Value: DefaultFormat(),
},
cli.StringFlag{
Name: "iidfile",
@@ -121,7 +122,8 @@ var (
},
cli.StringFlag{
Name: "isolation",
- Usage: "`type` of process isolation to use",
+ Usage: "`type` of process isolation to use. Use BUILDAH_ISOLATION environment variable to override.",
+ Value: DefaultIsolation(),
},
cli.StringSliceFlag{
Name: "label",
@@ -129,7 +131,7 @@ var (
},
cli.BoolFlag{
Name: "layers",
- Usage: fmt.Sprintf("cache intermediate layers during build (default %t)", UseLayers()),
+ Usage: fmt.Sprintf("cache intermediate layers during build. Use BUILDAH_LAYERS environment variable to override. (default %t)", UseLayers()),
},
cli.BoolFlag{
Name: "no-cache",
@@ -161,8 +163,8 @@ var (
},
cli.StringFlag{
Name: "runtime",
- Usage: "`path` to an alternate runtime",
- Value: runtime,
+ Usage: "`path` to an alternate runtime. Use BUILDAH_RUNTIME environment variable to override.",
+ Value: util.Runtime(),
},
cli.StringSliceFlag{
Name: "runtime-flag",
@@ -260,3 +262,21 @@ func UseLayers() bool {
}
return false
}
+
+// DefaultFormat returns the default image format
+func DefaultFormat() string {
+ format := os.Getenv("BUILDAH_FORMAT")
+ if format != "" {
+ return format
+ }
+ return buildah.OCI
+}
+
+// DefaultIsolation returns the default image format
+func DefaultIsolation() string {
+ isolation := os.Getenv("BUILDAH_ISOLATION")
+ if isolation != "" {
+ return isolation
+ }
+ return buildah.OCI
+}