Vendor Bulidah 1.11.2

Vendor in Buildah 1.11.2 into libpod/Podman

Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
This commit is contained in:
TomSweeneyRedHat
2019-09-13 11:22:10 -04:00
parent 5c09c4d294
commit 440392d37b
32 changed files with 398 additions and 55 deletions

View File

@@ -17,6 +17,7 @@ import (
"github.com/containers/image/types"
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/openshift/imagebuilder"
"github.com/pkg/errors"
@@ -156,6 +157,8 @@ type BuildOptions struct {
BlobDirectory string
// Target the targeted FROM in the Dockerfile to build
Target string
// Devices are the additional devices to add to the containers
Devices []configs.Device
}
// BuildDockerfiles parses a set of one or more Dockerfiles (which may be
@@ -264,7 +267,7 @@ func BuildDockerfiles(ctx context.Context, store storage.Store, options BuildOpt
// dockerfile content and will use ctxDir as the base include path.
//
// Note: we cannot use cmd.StdoutPipe() as cmd.Wait() closes it.
func preprocessDockerfileContents(r io.ReadCloser, ctxDir string) (rdrCloser *io.ReadCloser, err error) {
func preprocessDockerfileContents(r io.Reader, ctxDir string) (rdrCloser *io.ReadCloser, err error) {
cppPath := "/usr/bin/cpp"
if _, err = os.Stat(cppPath); err != nil {
if os.IsNotExist(err) {

View File

@@ -20,6 +20,7 @@ import (
"github.com/containers/storage"
"github.com/containers/storage/pkg/archive"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/openshift/imagebuilder"
"github.com/openshift/imagebuilder/dockerfile/parser"
"github.com/pkg/errors"
@@ -90,6 +91,9 @@ type Executor struct {
excludes []string
unusedArgs map[string]struct{}
buildArgs map[string]string
addCapabilities []string
dropCapabilities []string
devices []configs.Device
}
// NewExecutor creates a new instance of the imagebuilder.Executor interface.
@@ -144,6 +148,9 @@ func NewExecutor(store storage.Store, options BuildOptions, mainNode *parser.Nod
blobDirectory: options.BlobDirectory,
unusedArgs: make(map[string]struct{}),
buildArgs: options.Args,
addCapabilities: options.AddCapabilities,
dropCapabilities: options.DropCapabilities,
devices: options.Devices,
}
if exec.err == nil {
exec.err = os.Stderr

View File

@@ -585,6 +585,9 @@ func (s *StageExecutor) prepare(ctx context.Context, stage imagebuilder.Stage, f
CommonBuildOpts: s.executor.commonBuildOptions,
DefaultMountsFilePath: s.executor.defaultMountsFilePath,
Format: s.executor.outputFormat,
AddCapabilities: s.executor.addCapabilities,
DropCapabilities: s.executor.dropCapabilities,
Devices: s.executor.devices,
}
// Check and see if the image is a pseudonym for the end result of a
@@ -757,9 +760,17 @@ func (s *StageExecutor) Execute(ctx context.Context, stage imagebuilder.Stage, b
if imgID, ref, err = s.commit(ctx, ib, s.executor.getCreatedBy(nil, ""), false, s.output); err != nil {
return "", nil, errors.Wrapf(err, "error committing base container")
}
} else if len(s.executor.labels) > 0 || len(s.executor.annotations) > 0 {
// The image would be modified by the labels passed
// via the command line, so we need to commit.
logCommit(s.output, -1)
if imgID, ref, err = s.commit(ctx, ib, s.executor.getCreatedBy(stage.Node, ""), true, s.output); err != nil {
return "", nil, err
}
} else {
// We don't need to squash the base image, so just
// reuse the base image.
// We don't need to squash the base image, and the
// image wouldn't be modified by the command line
// options, so just reuse the base image.
logCommit(s.output, -1)
if imgID, ref, err = s.tagExistingImage(ctx, s.builder.FromImageID, s.output); err != nil {
return "", nil, err