-
Notifications
You must be signed in to change notification settings - Fork 642
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
Improve removal of temporary tags. #725
Improve removal of temporary tags. #725
Conversation
* Allow an no-argument call to docker:save by chosing sane defaults * Reused ArchiveCompression for selecting the compression mode and a bit more
Signed-off-by: Thorsten Schaefer <github@npath.de>
Codecov Report
@@ Coverage Diff @@
## master #725 +/- ##
============================================
- Coverage 47.82% 47.51% -0.32%
- Complexity 1010 1023 +13
============================================
Files 125 126 +1
Lines 6605 6699 +94
Branches 851 872 +21
============================================
+ Hits 3159 3183 +24
- Misses 3176 3244 +68
- Partials 270 272 +2
Continue to review full report at Codecov.
|
thanks for the PR and sorry for the delay. quite busy weeks ;-( The reason why tags are not overwritten forcefully is, that there could be an equally named image which has been created outside of and not related to d-m-p, too. Unlikely, I know, but overwriting this tag is probably not very polite. I agreed that the information that a temporary tag couldn't be removed should bubble up. But maybe we could do it without chaining the DockerAccess exception but merging it into one: sth like finally {
if (!removeTag(...)) {
if (dae == null) {
throw new DockerAccessException("Image %s could be pushed, but the temporary tag could not be removed", ...);
} else {
throw new DockerAccessException(dae.getCause(), dae.getMessage() + " and the temporary tag could not be removed, too");
}
}
} Still not sure whether the removing of the temporary tag should be considered an fatal error breaking call as the image already could be pushed. Would be awesome if there would be a rollback ;-), but there's nothing like removing an image from a registry .... |
@thoschaefer what's you opinion on an adapted error handling as mentioned above ? |
I think your proposal regarding adapting error handling sounds valid. I will update my PR accordingly. Regarding you thought about "whether removing of the temporary tag should be considered a fatal error": I am not sure anymore if it should be a fatal error. On the other hand it's confusing if a later build fails because it stumbles upon the non-removed temporary image. Don't understand yet why the image could not be removed. Maybe also worth a retry. |
PR merged! Thanks!
…oka/docker-maven-plugin into pr/Katsuya-Tomioka-docker-save-support
* Removed attaching of artifacts as they are too huge anyway * Harmonized properties name to be more specific * Added a bit to documentation * Fixed fetching of all images by using the full name
PR merged! Thanks!
…m/thoschaefer/docker-maven-plugin into pr/thoschaefer-fix/improve_temporary_tag_removal
looks good to me. Let's fail the build if the temporary image could not be removed. |
[merge] |
…ry_tag_removal PR merged! Thanks!
Make sure to notify the user if removal of temporary image failed. Also set the force parameter when trying to remove temporary image.
We observed at our Jenkins instance that build job 'n' succeeded but failed to remove the docker tag. Build job 'n+1' then failed with
"Cannot temporarily tag %s with %s because target image already exists. " +
"Please remove this and retry.",
from method tagTemporaryImage. I also wonder if tagTemporaryImage should not try to simply overwrite existing target tags as docker would do it this way itself. That could be another PR I guess.