Skip to content
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

docker:save fails if no images are defined #1185

Closed
wrose504 opened this issue Apr 1, 2019 · 5 comments
Closed

docker:save fails if no images are defined #1185

wrose504 opened this issue Apr 1, 2019 · 5 comments
Labels

Comments

@wrose504
Copy link

wrose504 commented Apr 1, 2019

If the save goal is executed when no images are defined, it fails with a message indicating that multiple images are defined. This occurs because the code checks whether the image list size is exactly one, and does not consider the possibility that the list is empty.

The warning is then emitted just below:

throw new MojoExecutionException("More than one image with build configuration is defined. Please specify the image with 'docker.name' or 'docker.alias'.");

I came across this issue when I bound the docker:save goal to the install phase in a parent pom that defined no images, with the intention of defining images only in child poms. However, this code meant that the parent failed to build.

I was able to work around this with a non-inherited plugin configuration in the parent that set skipSave=true, but it seems like it would be better if the mojo would skip over projects where there were no images without raising an error.

@rhuss
Copy link
Collaborator

rhuss commented Apr 6, 2019

Good catch. Fancy to submit a PR ?

@rhuss rhuss added the bug label Apr 6, 2019
@wrose504
Copy link
Author

wrose504 commented Apr 7, 2019

I would, but I'm not sure whether my employer allows open-source contributions without prior approval. I will check though.

@rhuss
Copy link
Collaborator

rhuss commented Apr 7, 2019

@wrose504 cool. Maybe it helps as an argument, that you are using that open source component for your product and you would like to help to fix it (which then also helps your productised usage).

That is how open source works btw.

wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 9, 2019
…efined.

Signed-off-by: William Rose <william.rose@nuance.com>
wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 9, 2019
…efined.

Signed-off-by: William Rose <william.rose@nuance.com>
@wrosenuance
Copy link
Contributor

I figured out the company policy and I have created PR #1194 using my other account.

I tested it against 0.28.0 as a baseline because the recent changes on master mean the test suite no longer runs cleanly on Windows, but the patch is small and applies cleanly to master.

@rhuss
Copy link
Collaborator

rhuss commented Apr 9, 2019

Cool, thanks a lot for your support !

Sorry we don't do regular tests on Windows (we should though). Could you please open another issue witht the Windows build problems ? That would be awesome !

wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 9, 2019
…efined.

Signed-off-by: William Rose <william.rose@nuance.com>
wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 9, 2019
…efined.

Signed-off-by: William Rose <william.rose@nuance.com>
wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 9, 2019
…efined.

Signed-off-by: William Rose <william.rose@nuance.com>
wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 9, 2019
…efined.

Signed-off-by: William Rose <william.rose@nuance.com>
wrosenuance added a commit to wrosenuance/docker-maven-plugin that referenced this issue Apr 9, 2019
…efined.

Signed-off-by: William Rose <william.rose@nuance.com>
rhuss added a commit that referenced this issue Apr 9, 2019
* Issue #1185 Prevent docker:save failing when no images are defined.

Signed-off-by: William Rose <william.rose@nuance.com>

* chore(docker:save): Some refactoring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants