Open cdprete opened 2 years ago
As with #29706, you can save us all some time by providing a minimal sample that reproduces the problem. It would also be useful if you shared the build output when the problem occurs.
@wilkinsona I gave you here already all the needed building blocks ;)
Anyway, here there is a demo for it: https://github.com/cdprete/github_spring_boot_issue_29756
As you can see from the README, the publishRegistry
block is evaluated anyway, even if the spring-boot.build-image.publish
flag is set to false
.
@cdprete Is there a real-world reason for providing either the username or password alone, instead of always providing neither or both, or is this something you happened up when testing? The plugin is working as designed now, and I'm not sure that ignoring invalid configuration that might not be used is a good idea. I'll label it so the rest of the team can provide opinions on this also.
@scottfrederick I want to prevent build failures if not all the properties have been provided. Moreover, if I set the plugin to skip the publishing, I assume it should not really care what it's under the publishRegistry
block.
In the ideal world, you would have 2 different goals bound to 2 different phases. One for building the image (done on package
for example) and one for publishing it (done on deploy
for example).
In the ideal world, you would have 2 different goals bound to 2 different phases. One for building the image (done on package for example) and one for publishing it (done on deploy for example).
The Spring Boot plugin is not a general purpose plugin for Docker operations so we are not going to do that, see #26187.
I agree that we should not attempt to validate that part of a plugin configuration is valid if the feature is disabled. I can see now that everything is backed by a DockerConfiguration
object. Perhaps this can be refactored to lazily request things rather than doing this upfront?
I was not aware of https://github.com/spring-projects/spring-boot/issues/26187 :) But yes, the main issue remains ;)
Hi. I'm using Spring Boot 2.6.3 and I've the spring-boot-maven-plugin configured in the following way:
where the registry credentials are simply empty as
I've tried to set the
publish
flag dynamically with Groovy in order to set it tofalse
if one of the credentials is missing. Everything works fine if both the credentials are missing. As soon as one is specified, thepublishRegistry
block complains even though thepublish
flag isfalse
.The Groovy part is
Ideally, if the
publish
flag isfalse
, I would expect that the registry is completely ignored since it will not be used anyway.