Skip to content

Commit

Permalink
Fix lazy evaluation (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
darora authored Feb 15, 2018
1 parent fa36734 commit 014d5c2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class PalantirDockerPlugin implements Plugin<Project> {

push.with {
workingDir dockerDir
commandLine 'docker', 'push', ext.name
commandLine 'docker', 'push', "${ -> ext.name}"
}

dockerfileZip.with {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,42 @@ class PalantirDockerPluginTests extends AbstractPluginTest {
buildResult.output.contains('dockerPushAnother')
}


def 'does not throw if name is configured after evaluation phase'() {
given:
String id = 'id6'
file('Dockerfile') << """
FROM alpine:3.2
MAINTAINER ${id}
""".stripIndent()
buildFile << """
plugins {
id 'com.palantir.docker'
}
docker {
tags 'latest', 'another'
}
afterEvaluate {
docker.name = '${id}'
}
""".stripIndent()

when:
BuildResult buildResult = with('dockerTag').build()

then:
buildResult.task(':dockerPrepare').outcome == TaskOutcome.SUCCESS
buildResult.task(':docker').outcome == TaskOutcome.SUCCESS
buildResult.task(':dockerTag').outcome == TaskOutcome.SUCCESS
exec("docker inspect --format '{{.Author}}' ${id}") == "'${id}'\n"
exec("docker inspect --format '{{.Author}}' ${id}:latest") == "'${id}'\n"
exec("docker inspect --format '{{.Author}}' ${id}:another") == "'${id}'\n"
execCond("docker rmi -f ${id}")
execCond("docker rmi -f ${id}:another")
}

def 'running tag task creates images with specified tags'() {
given:
String id = 'id6'
Expand Down

0 comments on commit 014d5c2

Please sign in to comment.