From 22b1d10d31dfa31da14171c4eebd599dcd4523fc Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 23 Oct 2020 08:18:13 +0000 Subject: 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] Signed-off-by: Daniel J Walsh --- .../github.com/openshift/imagebuilder/builder.go | 31 ++++++++++------------ 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'vendor/github.com/openshift/imagebuilder/builder.go') 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 -- cgit v1.2.3-54-g00ecf