-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix docker push errors not failing build
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...ctTest/groovy/com/bmuschko/gradle/docker/tasks/image/DockerPushImageFunctionalTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.bmuschko.gradle.docker.tasks.image | ||
|
||
import com.bmuschko.gradle.docker.AbstractGroovyDslFunctionalTest | ||
import org.gradle.testkit.runner.BuildResult | ||
|
||
class DockerPushImageFunctionalTest extends AbstractGroovyDslFunctionalTest { | ||
|
||
def "fails on push error"() { | ||
def image = createUniqueImageId() | ||
|
||
buildFile << """ | ||
import com.bmuschko.gradle.docker.tasks.image.Dockerfile | ||
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage | ||
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage | ||
task dockerfile(type: Dockerfile) { | ||
from '$TEST_IMAGE_WITH_TAG' | ||
label(['maintainer': '[email protected]']) | ||
} | ||
task buildImage(type: DockerBuildImage) { | ||
dependsOn dockerfile | ||
inputDir = file("build/docker") | ||
images.add("${image}") | ||
} | ||
task pushImage(type: DockerPushImage) { | ||
dependsOn buildImage | ||
images.add("${image}") | ||
} | ||
""" | ||
|
||
when: | ||
BuildResult result = build('pushImage') | ||
|
||
then: | ||
def e = thrown(Exception) | ||
e.message.contains("Could not push image") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters