mirror of
https://github.com/containers/podman.git
synced 2025-12-09 07:09:03 +08:00
Update to the latest version of buildah
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
46
vendor/github.com/containers/buildah/imagebuildah/executor.go
generated
vendored
46
vendor/github.com/containers/buildah/imagebuildah/executor.go
generated
vendored
@@ -11,7 +11,9 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/containers/buildah"
|
||||
"github.com/containers/buildah/pkg/parse"
|
||||
"github.com/containers/buildah/util"
|
||||
"github.com/containers/common/pkg/config"
|
||||
"github.com/containers/image/v5/docker/reference"
|
||||
is "github.com/containers/image/v5/storage"
|
||||
"github.com/containers/image/v5/transports"
|
||||
@@ -91,17 +93,44 @@ type Executor struct {
|
||||
excludes []string
|
||||
unusedArgs map[string]struct{}
|
||||
buildArgs map[string]string
|
||||
addCapabilities []string
|
||||
dropCapabilities []string
|
||||
capabilities []string
|
||||
devices []configs.Device
|
||||
signBy string
|
||||
architecture string
|
||||
os string
|
||||
}
|
||||
|
||||
// NewExecutor creates a new instance of the imagebuilder.Executor interface.
|
||||
func NewExecutor(store storage.Store, options BuildOptions, mainNode *parser.Node) (*Executor, error) {
|
||||
defaultContainerConfig, err := config.Default()
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to get container config")
|
||||
}
|
||||
|
||||
excludes, err := imagebuilder.ParseDockerignore(options.ContextDirectory)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
capabilities := defaultContainerConfig.Capabilities("", options.AddCapabilities, options.DropCapabilities)
|
||||
|
||||
devices := []configs.Device{}
|
||||
for _, device := range append(defaultContainerConfig.Containers.AdditionalDevices, options.Devices...) {
|
||||
dev, err := parse.DeviceFromPath(device)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
devices = append(dev, devices...)
|
||||
}
|
||||
|
||||
transientMounts := []Mount{}
|
||||
for _, volume := range append(defaultContainerConfig.Containers.AdditionalVolumes, options.TransientMounts...) {
|
||||
mount, err := parse.Volume(volume)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
transientMounts = append([]Mount{Mount(mount)}, transientMounts...)
|
||||
}
|
||||
|
||||
exec := Executor{
|
||||
store: store,
|
||||
@@ -113,7 +142,7 @@ func NewExecutor(store storage.Store, options BuildOptions, mainNode *parser.Nod
|
||||
quiet: options.Quiet,
|
||||
runtime: options.Runtime,
|
||||
runtimeArgs: options.RuntimeArgs,
|
||||
transientMounts: options.TransientMounts,
|
||||
transientMounts: transientMounts,
|
||||
compression: options.Compression,
|
||||
output: options.Output,
|
||||
outputFormat: options.OutputFormat,
|
||||
@@ -148,9 +177,11 @@ 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,
|
||||
capabilities: capabilities,
|
||||
devices: devices,
|
||||
signBy: options.SignBy,
|
||||
architecture: options.Architecture,
|
||||
os: options.OS,
|
||||
}
|
||||
if exec.err == nil {
|
||||
exec.err = os.Stderr
|
||||
@@ -527,7 +558,7 @@ func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) (image
|
||||
if err := cleanup(); err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
||||
logrus.Debugf("printing final image id %q", imageID)
|
||||
if b.iidfile != "" {
|
||||
if err = ioutil.WriteFile(b.iidfile, []byte(imageID), 0644); err != nil {
|
||||
return imageID, ref, errors.Wrapf(err, "failed to write image ID to file %q", b.iidfile)
|
||||
@@ -537,7 +568,6 @@ func (b *Executor) Build(ctx context.Context, stages imagebuilder.Stages) (image
|
||||
return imageID, ref, errors.Wrapf(err, "failed to write image ID to stdout")
|
||||
}
|
||||
}
|
||||
|
||||
return imageID, ref, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user