-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail build upon error with push operation #1183
Conversation
|
||
class DockerPushImageFunctionalTest extends AbstractGroovyDslFunctionalTest { | ||
|
||
def "fails on push error"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a task for add a task for removing the container image after the push. You will also need to add a pull task to ensure that the container image is available before use. It's possible that your test case runs first and the image may not exist yet.
task removeImage(type: DockerRemoveImage) {
dependsOn buildImage
mustRunAfter pushImage, pullImage
targetImageId buildImage.getImageId()
force = true
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
BuildResult result = build('pushImage') | ||
|
||
then: | ||
def e = thrown(Exception) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check for DockerClientException
here. That's the one your are throwing from the callback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API doesn't seem to provide access to that information. I updated this to follow other examples
super.throwFirstError(); | ||
|
||
if (latestItem == null) { | ||
throw new DockerClientException("Could not push image"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to get the root cause of this failure e.g. one that indicates that incorrect credentials were used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
624e35a
to
9f24136
Compare
9f24136
to
d82860b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for changes. They'll go out with the next release of the plugin.
Fixes DockerPushImage task not failing when pushing fails
closes #1178