Skip to content

Commit

Permalink
[JENKINS-33745] Fixed unexpanded additional build arguments and conte…
Browse files Browse the repository at this point in the history
…xt (#40)

Fix JENKINS-33745
  • Loading branch information
Wattos authored and carlossg committed Apr 20, 2016
1 parent 06b8fc3 commit 8a5c462
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/cloudbees/dockerpublish/DockerBuilder.java
Expand Up @@ -341,12 +341,12 @@ private boolean maybeTagOnly() throws MacroEvaluationException, IOException, Int
}

private boolean buildAndTag() throws MacroEvaluationException, IOException, InterruptedException {
FilePath context = defined(getBuildContext()) ? new FilePath(new File(getBuildContext()))
FilePath context = defined(expandAll(getBuildContext())) ? new FilePath(new File(expandAll(getBuildContext())))
: build.getWorkspace();
Iterator<ImageTag> i = getImageTags().iterator();
Result lastResult = new Result();
if (i.hasNext()) {
lastResult = executeCmd("docker build " + getBuildAdditionalArgs() + " -t " + i.next()
lastResult = executeCmd("docker build " + expandAll(getBuildAdditionalArgs()) + " -t " + i.next()
+ ((isNoCache()) ? " --no-cache=true " : "") + " "
+ ((isForcePull()) ? " --pull=true " : "") + " "
+ (defined(getDockerfilePath()) ? " --file=" + getDockerfilePath() : "") + " "
Expand All @@ -365,7 +365,7 @@ private boolean buildAndTag() throws MacroEvaluationException, IOException, Inte
} else {
// we don't know the image name so rebuild the image for each tag
while (lastResult.result && i.hasNext()) {
lastResult = executeCmd("docker build " + getBuildAdditionalArgs() +" -t " + i.next()
lastResult = executeCmd("docker build " + expandAll(getBuildAdditionalArgs()) +" -t " + i.next()
+ ((isNoCache()) ? " --no-cache=true " : "") + " "
+ ((isForcePull()) ? " --pull=true " : "") + " "
+ (defined(getDockerfilePath()) ? " --file=" + getDockerfilePath() : "") + " "
Expand Down

0 comments on commit 8a5c462

Please sign in to comment.