mirror of
https://github.com/containers/podman.git
synced 2025-12-01 02:27:13 +08:00
vendor: update buildah to latest main
Includes one breaking change for the flag as BuildOutputs now accept a slice. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
54
vendor/github.com/containers/buildah/pkg/parse/parse.go
generated
vendored
54
vendor/github.com/containers/buildah/pkg/parse/parse.go
generated
vendored
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/containers/buildah/internal/sbom"
|
||||
"github.com/containers/buildah/internal/tmpdir"
|
||||
"github.com/containers/buildah/pkg/sshagent"
|
||||
"github.com/containers/common/libnetwork/etchosts"
|
||||
"github.com/containers/common/pkg/auth"
|
||||
"github.com/containers/common/pkg/config"
|
||||
"github.com/containers/common/pkg/parse"
|
||||
@@ -365,6 +366,9 @@ func validateExtraHost(val string) error {
|
||||
if len(arr) != 2 || len(arr[0]) == 0 {
|
||||
return fmt.Errorf("bad format for add-host: %q", val)
|
||||
}
|
||||
if arr[1] == etchosts.HostGateway {
|
||||
return nil
|
||||
}
|
||||
if _, err := validateIPAddress(arr[1]); err != nil {
|
||||
return fmt.Errorf("invalid IP address in add-host: %q", arr[1])
|
||||
}
|
||||
@@ -704,7 +708,7 @@ func AuthConfig(creds string) (*types.DockerAuthConfig, error) {
|
||||
// GetBuildOutput is responsible for parsing custom build output argument i.e `build --output` flag.
|
||||
// Takes `buildOutput` as string and returns BuildOutputOption
|
||||
func GetBuildOutput(buildOutput string) (define.BuildOutputOption, error) {
|
||||
if len(buildOutput) == 1 && buildOutput == "-" {
|
||||
if buildOutput == "-" {
|
||||
// Feature parity with buildkit, output tar to stdout
|
||||
// Read more here: https://docs.docker.com/engine/reference/commandline/build/#custom-build-outputs
|
||||
return define.BuildOutputOption{
|
||||
@@ -723,56 +727,48 @@ func GetBuildOutput(buildOutput string) (define.BuildOutputOption, error) {
|
||||
}
|
||||
isDir := true
|
||||
isStdout := false
|
||||
typeSelected := false
|
||||
pathSelected := false
|
||||
path := ""
|
||||
tokens := strings.Split(buildOutput, ",")
|
||||
for _, option := range tokens {
|
||||
arr := strings.SplitN(option, "=", 2)
|
||||
if len(arr) != 2 {
|
||||
typeSelected := ""
|
||||
pathSelected := ""
|
||||
for _, option := range strings.Split(buildOutput, ",") {
|
||||
key, value, found := strings.Cut(option, "=")
|
||||
if !found {
|
||||
return define.BuildOutputOption{}, fmt.Errorf("invalid build output options %q, expected format key=value", buildOutput)
|
||||
}
|
||||
switch arr[0] {
|
||||
switch key {
|
||||
case "type":
|
||||
if typeSelected {
|
||||
return define.BuildOutputOption{}, fmt.Errorf("duplicate %q not supported", arr[0])
|
||||
if typeSelected != "" {
|
||||
return define.BuildOutputOption{}, fmt.Errorf("duplicate %q not supported", key)
|
||||
}
|
||||
typeSelected = true
|
||||
switch arr[1] {
|
||||
typeSelected = value
|
||||
switch typeSelected {
|
||||
case "local":
|
||||
isDir = true
|
||||
case "tar":
|
||||
isDir = false
|
||||
default:
|
||||
return define.BuildOutputOption{}, fmt.Errorf("invalid type %q selected for build output options %q", arr[1], buildOutput)
|
||||
return define.BuildOutputOption{}, fmt.Errorf("invalid type %q selected for build output options %q", value, buildOutput)
|
||||
}
|
||||
case "dest":
|
||||
if pathSelected {
|
||||
return define.BuildOutputOption{}, fmt.Errorf("duplicate %q not supported", arr[0])
|
||||
if pathSelected != "" {
|
||||
return define.BuildOutputOption{}, fmt.Errorf("duplicate %q not supported", key)
|
||||
}
|
||||
pathSelected = true
|
||||
path = arr[1]
|
||||
pathSelected = value
|
||||
default:
|
||||
return define.BuildOutputOption{}, fmt.Errorf("unrecognized key %q in build output option: %q", arr[0], buildOutput)
|
||||
return define.BuildOutputOption{}, fmt.Errorf("unrecognized key %q in build output option: %q", key, buildOutput)
|
||||
}
|
||||
}
|
||||
|
||||
if !typeSelected || !pathSelected {
|
||||
return define.BuildOutputOption{}, fmt.Errorf("invalid build output option %q, accepted keys are type and dest must be present", buildOutput)
|
||||
if typeSelected == "" || pathSelected == "" {
|
||||
return define.BuildOutputOption{}, fmt.Errorf(`invalid build output option %q, accepted keys are "type" and "dest" must be present`, buildOutput)
|
||||
}
|
||||
|
||||
if path == "-" {
|
||||
if pathSelected == "-" {
|
||||
if isDir {
|
||||
return define.BuildOutputOption{}, fmt.Errorf("invalid build output option %q, type=local and dest=- is not supported", buildOutput)
|
||||
return define.BuildOutputOption{}, fmt.Errorf(`invalid build output option %q, "type=local" can not be used with "dest=-"`, buildOutput)
|
||||
}
|
||||
return define.BuildOutputOption{
|
||||
Path: "",
|
||||
IsDir: false,
|
||||
IsStdout: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
return define.BuildOutputOption{Path: path, IsDir: isDir, IsStdout: isStdout}, nil
|
||||
return define.BuildOutputOption{Path: pathSelected, IsDir: isDir, IsStdout: isStdout}, nil
|
||||
}
|
||||
|
||||
// TeeType parses a string value and returns a TeeType
|
||||
|
||||
Reference in New Issue
Block a user