summaryrefslogtreecommitdiff
path: root/vendor/github.com/openshift/imagebuilder/internals.go
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/internals.go
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/internals.go')
-rw-r--r--vendor/github.com/openshift/imagebuilder/internals.go25
1 files changed, 25 insertions, 0 deletions
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
+}