mirror of
https://github.com/containers/podman.git
synced 2025-12-02 19:28:58 +08:00
Update vendor or containers/buildah
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
49
vendor/github.com/containers/buildah/pkg/cli/build.go
generated
vendored
49
vendor/github.com/containers/buildah/pkg/cli/build.go
generated
vendored
@@ -20,6 +20,8 @@ import (
|
||||
"github.com/containers/buildah/pkg/util"
|
||||
"github.com/containers/common/pkg/auth"
|
||||
"github.com/containers/image/v5/docker/reference"
|
||||
"github.com/containers/image/v5/types"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -47,6 +49,18 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
output := ""
|
||||
cleanTmpFile := false
|
||||
tags := []string{}
|
||||
if iopts.Network == "none" {
|
||||
if c.Flag("dns").Changed {
|
||||
return options, nil, nil, errors.New("the --dns option cannot be used with --network=none")
|
||||
}
|
||||
if c.Flag("dns-option").Changed {
|
||||
return options, nil, nil, errors.New("the --dns-option option cannot be used with --network=none")
|
||||
}
|
||||
if c.Flag("dns-search").Changed {
|
||||
return options, nil, nil, errors.New("the --dns-search option cannot be used with --network=none")
|
||||
}
|
||||
|
||||
}
|
||||
if c.Flag("tag").Changed {
|
||||
tags = iopts.Tag
|
||||
if len(tags) > 0 {
|
||||
@@ -147,7 +161,7 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
// The context directory could be a URL. Try to handle that.
|
||||
tempDir, subDir, err := define.TempDirForURL("", "buildah", cliArgs[0])
|
||||
if err != nil {
|
||||
return options, nil, nil, fmt.Errorf("error prepping temporary context directory: %w", err)
|
||||
return options, nil, nil, fmt.Errorf("prepping temporary context directory: %w", err)
|
||||
}
|
||||
if tempDir != "" {
|
||||
// We had to download it to a temporary directory.
|
||||
@@ -158,7 +172,7 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
// Nope, it was local. Use it as is.
|
||||
absDir, err := filepath.Abs(cliArgs[0])
|
||||
if err != nil {
|
||||
return options, nil, nil, fmt.Errorf("error determining path to directory: %w", err)
|
||||
return options, nil, nil, fmt.Errorf("determining path to directory: %w", err)
|
||||
}
|
||||
contextDir = absDir
|
||||
}
|
||||
@@ -176,7 +190,7 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
|
||||
contextDir, err = filepath.EvalSymlinks(contextDir)
|
||||
if err != nil {
|
||||
return options, nil, nil, fmt.Errorf("error evaluating symlinks in build context path: %w", err)
|
||||
return options, nil, nil, fmt.Errorf("evaluating symlinks in build context path: %w", err)
|
||||
}
|
||||
|
||||
var stdin io.Reader
|
||||
@@ -197,7 +211,7 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
|
||||
systemContext, err := parse.SystemContextFromOptions(c)
|
||||
if err != nil {
|
||||
return options, nil, nil, fmt.Errorf("error building system context: %w", err)
|
||||
return options, nil, nil, fmt.Errorf("building system context: %w", err)
|
||||
}
|
||||
|
||||
isolation, err := parse.IsolationOption(iopts.Isolation)
|
||||
@@ -253,7 +267,7 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
}
|
||||
usernsOption, idmappingOptions, err := parse.IDMappingOptions(c, isolation)
|
||||
if err != nil {
|
||||
return options, nil, nil, fmt.Errorf("error parsing ID mapping options: %w", err)
|
||||
return options, nil, nil, fmt.Errorf("parsing ID mapping options: %w", err)
|
||||
}
|
||||
namespaceOptions.AddOrReplace(usernsOption...)
|
||||
|
||||
@@ -269,7 +283,7 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
|
||||
var excludes []string
|
||||
if iopts.IgnoreFile != "" {
|
||||
if excludes, _, err = parse.ContainerIgnoreFile(contextDir, iopts.IgnoreFile); err != nil {
|
||||
if excludes, _, err = parse.ContainerIgnoreFile(contextDir, iopts.IgnoreFile, containerfiles); err != nil {
|
||||
return options, nil, nil, err
|
||||
}
|
||||
}
|
||||
@@ -309,6 +323,18 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
if err != nil {
|
||||
return options, nil, nil, fmt.Errorf("unable to parse value provided %q as --cache-ttl: %w", iopts.CacheTTL, err)
|
||||
}
|
||||
// If user explicitly specified `--cache-ttl=0s`
|
||||
// it would effectively mean that user is asking
|
||||
// to use no cache at all. In such use cases
|
||||
// buildah can skip looking for cache entierly
|
||||
// by setting `--no-cache=true` internally.
|
||||
if int64(cacheTTL) == 0 {
|
||||
logrus.Debug("Setting --no-cache=true since --cache-ttl was set to 0s which effectively means user wants to ignore cache")
|
||||
if c.Flag("no-cache").Changed && !iopts.NoCache {
|
||||
return options, nil, nil, fmt.Errorf("cannot use --cache-ttl with duration as 0 and --no-cache=false")
|
||||
}
|
||||
iopts.NoCache = true
|
||||
}
|
||||
}
|
||||
var pullPushRetryDelay time.Duration
|
||||
pullPushRetryDelay, err = time.ParseDuration(iopts.RetryDelay)
|
||||
@@ -318,6 +344,16 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
// Following log line is used in integration test.
|
||||
logrus.Debugf("Setting MaxPullPushRetries to %d and PullPushRetryDelay to %v", iopts.Retry, pullPushRetryDelay)
|
||||
|
||||
if c.Flag("network").Changed && c.Flag("isolation").Changed {
|
||||
if isolation == define.IsolationChroot {
|
||||
if ns := namespaceOptions.Find(string(specs.NetworkNamespace)); ns != nil {
|
||||
if !ns.Host {
|
||||
return options, nil, nil, fmt.Errorf("cannot set --network other than host with --isolation %s", c.Flag("isolation").Value.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
options = define.BuildOptions{
|
||||
AddCapabilities: iopts.CapAdd,
|
||||
AdditionalBuildContexts: additionalBuildContext,
|
||||
@@ -378,6 +414,7 @@ func GenBuildOptions(c *cobra.Command, inputArgs []string, iopts BuildOptions) (
|
||||
RusageLogFile: iopts.RusageLogFile,
|
||||
SignBy: iopts.SignBy,
|
||||
SignaturePolicyPath: iopts.SignaturePolicy,
|
||||
SkipUnusedStages: types.NewOptionalBool(iopts.SkipUnusedStages),
|
||||
Squash: iopts.Squash,
|
||||
SystemContext: systemContext,
|
||||
Target: iopts.Target,
|
||||
|
||||
2
vendor/github.com/containers/buildah/pkg/cli/common.go
generated
vendored
2
vendor/github.com/containers/buildah/pkg/cli/common.go
generated
vendored
@@ -89,6 +89,7 @@ type BudResults struct {
|
||||
SignaturePolicy string
|
||||
SignBy string
|
||||
Squash bool
|
||||
SkipUnusedStages bool
|
||||
Stdin bool
|
||||
Tag []string
|
||||
BuildOutput string
|
||||
@@ -260,6 +261,7 @@ func GetBudFlags(flags *BudResults) pflag.FlagSet {
|
||||
if err := fs.MarkHidden("signature-policy"); err != nil {
|
||||
panic(fmt.Sprintf("error marking the signature-policy flag as hidden: %v", err))
|
||||
}
|
||||
fs.BoolVar(&flags.SkipUnusedStages, "skip-unused-stages", true, "skips stages in multi-stage builds which do not affect the final target")
|
||||
fs.BoolVar(&flags.Squash, "squash", false, "squash newly built layers into a single new layer")
|
||||
fs.StringArrayVar(&flags.SSH, "ssh", []string{}, "SSH agent socket or keys to expose to the build. (format: default|<id>[=<socket>|<key>[,<key>]])")
|
||||
fs.BoolVar(&flags.Stdin, "stdin", false, "pass stdin into containers")
|
||||
|
||||
Reference in New Issue
Block a user