summaryrefslogtreecommitdiff
path: root/vendor/github.com/openshift/imagebuilder
diff options
context:
space:
mode:
authorTomSweeneyRedHat <tsweeney@redhat.com>2020-06-17 15:32:12 -0400
committerTomSweeneyRedHat <tsweeney@redhat.com>2020-06-17 15:32:22 -0400
commitfde8040faabbaf6eac24a28a60631cd4b3337e91 (patch)
treeeed5fe6373c7c2d4d82672f521f52185121577e8 /vendor/github.com/openshift/imagebuilder
parentfd184fa4a1d0bd7797de1fb062c90e1a6d56bd1e (diff)
downloadpodman-fde8040faabbaf6eac24a28a60631cd4b3337e91.tar.gz
podman-fde8040faabbaf6eac24a28a60631cd4b3337e91.tar.bz2
podman-fde8040faabbaf6eac24a28a60631cd4b3337e91.zip
Bump Buildah to v1.15.0
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Diffstat (limited to 'vendor/github.com/openshift/imagebuilder')
-rw-r--r--vendor/github.com/openshift/imagebuilder/builder.go15
-rw-r--r--vendor/github.com/openshift/imagebuilder/dispatchers.go6
-rw-r--r--vendor/github.com/openshift/imagebuilder/imagebuilder.spec2
-rw-r--r--vendor/github.com/openshift/imagebuilder/internals.go25
4 files changed, 42 insertions, 6 deletions
diff --git a/vendor/github.com/openshift/imagebuilder/builder.go b/vendor/github.com/openshift/imagebuilder/builder.go
index 7f2f6e482..ffc3b257f 100644
--- a/vendor/github.com/openshift/imagebuilder/builder.go
+++ b/vendor/github.com/openshift/imagebuilder/builder.go
@@ -332,10 +332,19 @@ func ParseFile(path string) (*parser.Node, error) {
// Step creates a new step from the current state.
func (b *Builder) Step() *Step {
- dst := make([]string, len(b.Env)+len(b.RunConfig.Env))
- copy(dst, b.Env)
+ argsMap := make(map[string]string)
+ for _, argsVal := range b.Arguments() {
+ val := strings.Split(argsVal, "=")
+ if len(val) > 1 {
+ argsMap[val[0]] = val[1]
+ }
+ }
+
+ userArgs := makeUserArgs(b.Env, argsMap)
+ dst := make([]string, len(userArgs)+len(b.RunConfig.Env))
+ copy(dst, userArgs)
dst = append(dst, b.RunConfig.Env...)
- dst = append(dst, b.Arguments()...)
+
return &Step{Env: dst}
}
diff --git a/vendor/github.com/openshift/imagebuilder/dispatchers.go b/vendor/github.com/openshift/imagebuilder/dispatchers.go
index 1d77a193b..3a350fbee 100644
--- a/vendor/github.com/openshift/imagebuilder/dispatchers.go
+++ b/vendor/github.com/openshift/imagebuilder/dispatchers.go
@@ -153,8 +153,9 @@ func add(b *Builder, args []string, attributes map[string]bool, flagArgs []strin
var chown string
last := len(args) - 1
dest := makeAbsolute(args[last], b.RunConfig.WorkingDir)
+ userArgs := makeUserArgs(b.Env, b.Args)
for _, a := range flagArgs {
- arg, err := ProcessWord(a, b.Env)
+ arg, err := ProcessWord(a, userArgs)
if err != nil {
return err
}
@@ -181,8 +182,9 @@ func dispatchCopy(b *Builder, args []string, attributes map[string]bool, flagArg
dest := makeAbsolute(args[last], b.RunConfig.WorkingDir)
var chown string
var from string
+ userArgs := makeUserArgs(b.Env, b.Args)
for _, a := range flagArgs {
- arg, err := ProcessWord(a, b.Env)
+ arg, err := ProcessWord(a, userArgs)
if err != nil {
return err
}
diff --git a/vendor/github.com/openshift/imagebuilder/imagebuilder.spec b/vendor/github.com/openshift/imagebuilder/imagebuilder.spec
index 07c880166..3b32403a7 100644
--- a/vendor/github.com/openshift/imagebuilder/imagebuilder.spec
+++ b/vendor/github.com/openshift/imagebuilder/imagebuilder.spec
@@ -12,7 +12,7 @@
#
%global golang_version 1.8.1
-%{!?version: %global version 1.1-dev}
+%{!?version: %global version 1.1.5}
%{!?release: %global release 1}
%global package_name imagebuilder
%global product_name Container Image Builder
diff --git a/vendor/github.com/openshift/imagebuilder/internals.go b/vendor/github.com/openshift/imagebuilder/internals.go
index 3c60c7983..b652dc1c7 100644
--- a/vendor/github.com/openshift/imagebuilder/internals.go
+++ b/vendor/github.com/openshift/imagebuilder/internals.go
@@ -92,3 +92,28 @@ func parseOptInterval(f *flag.Flag) (time.Duration, error) {
}
return d, nil
}
+
+// makeUserArgs - Package the variables from the Dockerfile defined by
+// the ENV aand the ARG statements into one slice so the values
+// defined by both can later be evaluated when resolving variables
+// such as ${MY_USER}. If the variable is defined by both ARG and ENV
+// don't include the definition of the ARG variable.
+func makeUserArgs(bEnv []string, bArgs map[string]string) (userArgs []string) {
+
+ userArgs = bEnv
+ envMap := make(map[string]string)
+ for _, envVal := range bEnv {
+ val := strings.Split(envVal, "=")
+ if len(val) > 1 {
+ envMap[val[0]] = val[1]
+ }
+ }
+
+ for key, value := range bArgs {
+ if _, ok := envMap[key]; ok {
+ continue
+ }
+ userArgs = append(userArgs, key+"="+value)
+ }
+ return userArgs
+}