Skip to content

Commit

Permalink
Update imagebuild depdency to support heading ARGs in Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>

Closes: #1128
Approved by: TomSweeneyRedHat
  • Loading branch information
vdemeester authored and rh-atomic-bot committed Nov 8, 2018
1 parent 48cede4 commit 74e0b6f
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 10 deletions.
5 changes: 4 additions & 1 deletion imagebuildah/build.go
Expand Up @@ -1342,7 +1342,10 @@ func BuildDockerfiles(ctx context.Context, store storage.Store, options BuildOpt
return "", nil, errors.Wrapf(err, "error creating build executor")
}
b := imagebuilder.NewBuilder(options.Args)
stages := imagebuilder.NewStages(mainNode, b)
stages, err := imagebuilder.NewStages(mainNode, b)
if err != nil {
return "", nil, errors.Wrap(err, "error reading multiple stages")
}
return exec.Build(ctx, stages)
}

Expand Down
12 changes: 12 additions & 0 deletions tests/bud.bats
Expand Up @@ -1006,3 +1006,15 @@ load helpers
[ "$status" -ne 0 ]
}

@test "bud with ARG before FROM default value" {
target=leading-args-default
run buildah bud --signature-policy ${TESTSDIR}/policy.json -t ${target} -f ${TESTSDIR}/bud/leading-args/Dockerfile ${TESTSDIR}/bud/leading-args
[ "$status" -eq 0 ]
}

@test "bud with ARG before FROM" {
target=leading-args
run buildah bud --signature-policy ${TESTSDIR}/policy.json -t ${target} --build-arg=VERSION=musl -f ${TESTSDIR}/bud/leading-args/Dockerfile ${TESTSDIR}/bud/leading-args
[ "$status" -eq 0 ]
}

5 changes: 5 additions & 0 deletions tests/bud/leading-args/Dockerfile
@@ -0,0 +1,5 @@
ARG VERSION=latest
ARG FOO=bar
FROM busybox:$VERSION
ENV FOO $FOO
RUN echo $FOO $VERSION
39 changes: 37 additions & 2 deletions vendor/github.com/openshift/imagebuilder/builder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 18 additions & 5 deletions vendor/github.com/openshift/imagebuilder/dispatchers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions vendor/github.com/openshift/imagebuilder/evaluator.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 74e0b6f

Please sign in to comment.