Update containers/buildah v1.24.1

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2022-02-03 18:33:22 -05:00
parent 608b6142ed
commit 1d1b2b1509
42 changed files with 1491 additions and 1224 deletions

View File

@ -1,8 +1,8 @@
language: go
go:
- "1.9"
- "1.10"
- "1.16"
- "1.17"
install:

View File

@ -303,6 +303,9 @@ type Builder struct {
PendingCopies []Copy
Warnings []string
// Raw platform string specified with `FROM --platform` of the stage
// It's up to the implementation or client to parse and use this field
Platform string
}
func NewBuilder(args map[string]string) *Builder {
@ -470,7 +473,7 @@ func (b *Builder) FromImage(image *docker.Image, node *parser.Node) error {
b.RunConfig.Env = nil
// Check to see if we have a default PATH, note that windows won't
// have one as its set by HCS
// have one as it's set by HCS
if runtime.GOOS != "windows" && !hasEnvName(b.Env, "PATH") {
b.RunConfig.Env = append(b.RunConfig.Env, "PATH="+defaultPathEnv)
}

View File

@ -234,6 +234,20 @@ func from(b *Builder, args []string, attributes map[string]bool, flagArgs []stri
return fmt.Errorf("Windows does not support FROM scratch")
}
}
userArgs := mergeEnv(envMapAsSlice(b.Args), b.Env)
for _, a := range flagArgs {
arg, err := ProcessWord(a, userArgs)
if err != nil {
return err
}
switch {
case strings.HasPrefix(arg, "--platform="):
platformString := strings.TrimPrefix(arg, "--platform=")
b.Platform = platformString
default:
return fmt.Errorf("FROM only supports the --platform flag")
}
}
b.RunConfig.Image = name
// TODO: handle onbuild
return nil
@ -573,65 +587,63 @@ var targetArgs = []string{"TARGETOS", "TARGETARCH", "TARGETVARIANT"}
// to builder using the --build-arg flag for expansion/subsitution or passing to 'run'.
// Dockerfile author may optionally set a default value of this variable.
func arg(b *Builder, args []string, attributes map[string]bool, flagArgs []string, original string) error {
if len(args) != 1 {
return fmt.Errorf("ARG requires exactly one argument definition")
}
var (
name string
value string
hasDefault bool
)
arg := args[0]
// 'arg' can just be a name or name-value pair. Note that this is different
// from 'env' that handles the split of name and value at the parser level.
// The reason for doing it differently for 'arg' is that we support just
// defining an arg and not assign it a value (while 'env' always expects a
// name-value pair). If possible, it will be good to harmonize the two.
if strings.Contains(arg, "=") {
parts := strings.SplitN(arg, "=", 2)
name = parts[0]
value = parts[1]
hasDefault = true
if name == "TARGETPLATFORM" {
p, err := platforms.Parse(value)
if err != nil {
return fmt.Errorf("error parsing TARGETPLATFORM argument")
}
for _, val := range targetArgs {
b.AllowedArgs[val] = true
}
b.Args["TARGETPLATFORM"] = p.OS + "/" + p.Architecture
b.Args["TARGETOS"] = p.OS
b.Args["TARGETARCH"] = p.Architecture
b.Args["TARGETVARIANT"] = p.Variant
if p.Variant != "" {
b.Args["TARGETPLATFORM"] = b.Args["TARGETPLATFORM"] + "/" + p.Variant
for _, argument := range args {
arg := argument
// 'arg' can just be a name or name-value pair. Note that this is different
// from 'env' that handles the split of name and value at the parser level.
// The reason for doing it differently for 'arg' is that we support just
// defining an arg and not assign it a value (while 'env' always expects a
// name-value pair). If possible, it will be good to harmonize the two.
if strings.Contains(arg, "=") {
parts := strings.SplitN(arg, "=", 2)
name = parts[0]
value = parts[1]
hasDefault = true
if name == "TARGETPLATFORM" {
p, err := platforms.Parse(value)
if err != nil {
return fmt.Errorf("error parsing TARGETPLATFORM argument")
}
for _, val := range targetArgs {
b.AllowedArgs[val] = true
}
b.Args["TARGETPLATFORM"] = p.OS + "/" + p.Architecture
b.Args["TARGETOS"] = p.OS
b.Args["TARGETARCH"] = p.Architecture
b.Args["TARGETVARIANT"] = p.Variant
if p.Variant != "" {
b.Args["TARGETPLATFORM"] = b.Args["TARGETPLATFORM"] + "/" + p.Variant
}
}
} else if val, ok := builtinBuildArgs[arg]; ok {
name = arg
value = val
hasDefault = true
} else {
name = arg
hasDefault = false
}
} else if val, ok := builtinBuildArgs[arg]; ok {
name = arg
value = val
hasDefault = true
} else {
name = arg
hasDefault = false
}
// add the arg to allowed list of build-time args from this step on.
b.AllowedArgs[name] = true
// add the arg to allowed list of build-time args from this step on.
b.AllowedArgs[name] = true
// If there is still no default value, a value can be assigned from the heading args
if val, ok := b.HeadingArgs[name]; ok && !hasDefault {
b.Args[name] = val
}
// If there is still no default value, a value can be assigned from the heading args
if val, ok := b.HeadingArgs[name]; ok && !hasDefault {
b.Args[name] = val
}
// If there is a default value associated with this arg then add it to the
// b.buildArgs, later default values for the same arg override earlier ones.
// The args passed to builder (UserArgs) override the default value of 'arg'
// Don't add them here as they were already set in NewBuilder.
if _, ok := b.UserArgs[name]; !ok && hasDefault {
b.Args[name] = value
// If there is a default value associated with this arg then add it to the
// b.buildArgs, later default values for the same arg override earlier ones.
// The args passed to builder (UserArgs) override the default value of 'arg'
// Don't add them here as they were already set in NewBuilder.
if _, ok := b.UserArgs[name]; !ok && hasDefault {
b.Args[name] = value
}
}
return nil

18
vendor/github.com/openshift/imagebuilder/go.mod generated vendored Normal file
View File

@ -0,0 +1,18 @@
module github.com/openshift/imagebuilder
go 1.16
require (
github.com/containerd/containerd v1.5.9
github.com/containers/storage v1.37.0
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v20.10.12+incompatible
github.com/docker/go-connections v0.4.1-0.20210727194412-58542c764a11 // indirect
github.com/fsouza/go-dockerclient v1.7.7
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0
golang.org/x/net v0.0.0-20220114011407-0dd24b26b47d // indirect
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 // indirect
k8s.io/klog v1.0.0
)

1003
vendor/github.com/openshift/imagebuilder/go.sum generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,7 @@ func hasSlash(input string) bool {
// makeAbsolute ensures that the provided path is absolute.
func makeAbsolute(dest, workingDir string) string {
// Twiddle the destination when its a relative path - meaning, make it
// Twiddle the destination when it's a relative path - meaning, make it
// relative to the WORKINGDIR
if dest == "." {
if !hasSlash(workingDir) {

View File

@ -1,25 +0,0 @@
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
github.com/containerd/containerd v1.3.0
github.com/containers/storage v1.2
github.com/docker/docker b68221c37ee597950364788204546f9c9d0e46a1
github.com/docker/go-connections 97c2040d34dfae1d1b1275fa3a78dbdd2f41cf7e
github.com/docker/go-units 2fb04c6466a548a03cb009c5569ee1ab1e35398e
github.com/fsouza/go-dockerclient openshift-4.0 https://github.com/openshift/go-dockerclient.git
github.com/gogo/protobuf c5a62797aee0054613cc578653a16c6237fef080
github.com/konsorten/go-windows-terminal-sequences f55edac94c9bbba5d6182a4be46d86a2c9b5b50e
github.com/Microsoft/go-winio 1a8911d1ed007260465c3bfbbc785ac6915a0bb8
github.com/Nvveen/Gotty cd527374f1e5bff4938207604a14f2e38a9cf512
github.com/opencontainers/go-digest ac19fd6e7483ff933754af248d80be865e543d22
github.com/opencontainers/image-spec 243ea084a44451d27322fed02b682d99e2af3ba9
github.com/opencontainers/runc 923a8f8a9a07aceada5fc48c4d37e905d9b019b5
github.com/pkg/errors 27936f6d90f9c8e1145f11ed52ffffbfdb9e0af7
github.com/pquerna/ffjson d49c2bc1aa135aad0c6f4fc2056623ec78f5d5ac
github.com/sirupsen/logrus d7b6bf5e4d26448fd977d07d745a2a66097ddecb
golang.org/x/crypto ff983b9c42bc9fbf91556e191cc8efb585c16908
golang.org/x/net 45ffb0cd1ba084b73e26dee67e667e1be5acce83
golang.org/x/sys 7fbe1cd0fcc20051e1fcb87fbabec4a1bacaaeba
k8s.io/klog 8e90cee79f823779174776412c13478955131846
google.golang.org/grpc 6eaf6f47437a6b4e2153a190160ef39a92c7eceb # v1.23.0
github.com/golang/protobuf v1.2.0
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944