summaryrefslogtreecommitdiff
path: root/vendor/github.com/openshift/imagebuilder/builder.go
diff options
context:
space:
mode:
authordependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>2020-10-23 08:18:13 +0000
committerDaniel J Walsh <dwalsh@redhat.com>2020-10-23 06:52:53 -0400
commit22b1d10d31dfa31da14171c4eebd599dcd4523fc (patch)
tree1d6ad6eb695521e840239e24a879d8be36d5faaa /vendor/github.com/openshift/imagebuilder/builder.go
parent2adc1b284d7f61083d19e82822f79ea14c14de2d (diff)
downloadpodman-22b1d10d31dfa31da14171c4eebd599dcd4523fc.tar.gz
podman-22b1d10d31dfa31da14171c4eebd599dcd4523fc.tar.bz2
podman-22b1d10d31dfa31da14171c4eebd599dcd4523fc.zip
Bump github.com/containers/buildah from 1.16.4 to 1.16.5
Bumps [github.com/containers/buildah](https://github.com/containers/buildah) from 1.16.4 to 1.16.5. - [Release notes](https://github.com/containers/buildah/releases) - [Changelog](https://github.com/containers/buildah/blob/master/CHANGELOG.md) - [Commits](https://github.com/containers/buildah/compare/v1.16.4...v1.16.5) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/github.com/openshift/imagebuilder/builder.go')
-rw-r--r--vendor/github.com/openshift/imagebuilder/builder.go31
1 files changed, 14 insertions, 17 deletions
diff --git a/vendor/github.com/openshift/imagebuilder/builder.go b/vendor/github.com/openshift/imagebuilder/builder.go
index 583c303c0..22dc548b9 100644
--- a/vendor/github.com/openshift/imagebuilder/builder.go
+++ b/vendor/github.com/openshift/imagebuilder/builder.go
@@ -332,20 +332,10 @@ func ParseFile(path string) (*parser.Node, error) {
// Step creates a new step from the current state.
func (b *Builder) Step() *Step {
- argsMap := make(map[string]string)
- for _, argsVal := range b.Arguments() {
- val := strings.SplitN(argsVal, "=", 2)
- 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...)
-
- return &Step{Env: dst}
+ // Include build arguments in the table of variables that we'll use in
+ // Resolve(), but override them with values from the actual
+ // environment in case there's any conflict.
+ return &Step{Env: mergeEnv(b.Arguments(), mergeEnv(b.Env, b.RunConfig.Env))}
}
// Run executes a step, transforming the current builder and
@@ -473,7 +463,7 @@ func (b *Builder) FromImage(image *docker.Image, node *parser.Node) error {
SplitChildren(node, command.From)
b.RunConfig = *image.Config
- b.Env = append(b.Env, b.RunConfig.Env...)
+ b.Env = mergeEnv(b.Env, b.RunConfig.Env)
b.RunConfig.Env = nil
// Check to see if we have a default PATH, note that windows won't
@@ -573,14 +563,21 @@ var builtinAllowedBuildArgs = map[string]bool{
}
// ParseDockerIgnore returns a list of the excludes in the .dockerignore file.
-// extracted from fsouza/go-dockerclient.
+// extracted from fsouza/go-dockerclient and modified to drop comments and
+// empty lines.
func ParseDockerignore(root string) ([]string, error) {
var excludes []string
ignore, err := ioutil.ReadFile(filepath.Join(root, ".dockerignore"))
if err != nil && !os.IsNotExist(err) {
return excludes, fmt.Errorf("error reading .dockerignore: '%s'", err)
}
- return strings.Split(string(ignore), "\n"), nil
+ for _, e := range strings.Split(string(ignore), "\n") {
+ if len(e) == 0 || e[0] == '#' {
+ continue
+ }
+ excludes = append(excludes, e)
+ }
+ return excludes, nil
}
// ExportEnv creates an export statement for a shell that contains all of the