-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Openshift and Docker Extension Dependencies not activating from an activated Maven Profile #26589
Comments
Do you have a sample project you could share? Thanks |
Thanks for the follow-up. yes, I created a sample repository that has the dependencies I need. If you run a simple Sample Github repository: https://github.com/abeosoft/quarkus-openshift-deploy Thank you |
Your sample contains both |
I need to build a docker image and then deploy to Openshift. So, how would I conditionally enable an extension? A sample pom.xml will be appreciated. Are there any particular Quarkus best practices or recommendations for deploying to Kubernetes using a CI/CD platform like Jenkins/ArgoCD, etc? Thank you |
I don't have a sample pom, but you would need to make sure that only one extension that makes container images is present in any profile (or alternatively, set the property indicated by the error message). |
Thanks, 😄 👍 |
🙏🏼 |
I added the property as you recommended, but I am still getting a build error. Basically, I commented out the docker builder extension dependency and added the following property:
It is not clear what property/value should be. I also tried setting this property in the application.properties, and got the same error
Error:
|
I opened #26926 to improve the error message |
Improve error message when multiple container image extensions are present
Closed by #26926 |
Describe the bug
I have a project that uses the Docker and Openshift extensions. I created a maven profile for the Openshift/Docker build. I am using standard Quarkus flags/Environment Variables to configure and activate certain features. I prefer using Maven profiles to isolate different configurations geared towards different environments (local: Minikube vs, Dev: Openshift)
When I add the dependencies in the profile only without including them in the top level Dependencies element, the image doesn't get built or pushed to Openshift. If I add the dependencies at the top level, everything works perfectly
fine and the image is successfully built and deployed to Openshift.
<profile> <id>dev</id> <dependencies> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-container-image-docker</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-openshift</artifactId> </dependency> </dependencies> </profile>
% mvn clean package -Pdev \ -Dquarkus.application.name=my-app \ -Dquarkus.container-image.build=true \ -Dquarkus.container-image.push=true \ -Dquarkus.container-image.builder=docker \ -Dquarkus.container-image.name=my-app\ -Dquarkus.container-image.group=my-team\ -Dquarkus.container-image.tag=v1 \ -Dquarkus.container-image.registry=docker.corp.io \ -Dquarkus.container-image.username=… \ -Dquarkus.container-image.password=…. \ -Dquarkus.kubernetes.deploy=true \ -Dquarkus.kubernetes.deployment-target=openshift \ -Dquarkus.kubernetes-client.trust-certs=true \ -Dquarkus.openshift.labels.application=my-app \ -Dquarkus.openshift.deployment-kind=DeploymentConfig
Expected behavior
When a Maven profile is included, extensions included in the Profile dependencies should activate
Actual behavior
Openshift & Docker Extensions are not activating when included in a declared Maven profile
How to Reproduce?
Create a Quarkus project
Add a Maven profile
Include extensions for Docker & Openshift
Run a Maven command as shown above.
The image will not be built/deployed
Output of
uname -a
orver
Darwin Kernel Version 21.5.0
Output of
java -version
openjdk version "11.0.15" 2022-04-19 OpenJDK Runtime Environment GraalVM CE 22.1.0 (build 11.0.15+10-jvmci-22.1-b06) OpenJDK 64-Bit Server VM GraalVM CE 22.1.0 (build 11.0.15+10-jvmci-22.1-b06, mixed mode)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.9.2.Final and 2.10.1.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)3.8.5
Additional information
I have also encountered another issue when running regular maven package build with both docker and openshift extension dependencies are included in the top level dependencies element
% mvn clean package -Dquarkus.container-image.build=false -Dquarkus.container-image.push=false -Dquarkus.kubernetes.deploy=false
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.10.1.Final:build (default) on project my-app: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [ERROR] [error]: Build step io.quarkus.container.image.deployment.ContainerImageProcessor#publishImageInfo threw an exception: java.lang.IllegalStateException: quarkus-container-image-openshift and quarkus-container-image-docker were detected, at most one container-image extension can be present. [ERROR] Either remove the unneeded ones, or select one by adding the property 'quarkus.container-image.builder=<extension name (without the
container-image-prefix)>' in application.properties or as a system property. [ERROR] at io.quarkus.container.image.deployment.ContainerImageCapabilitiesUtil.getActiveContainerImageCapability(ContainerImageCapabilitiesUtil.java:33) [ERROR] at io.quarkus.container.image.deployment.ContainerImageProcessor.ensureSingleContainerImageExtension(ContainerImageProcessor.java:106) [ERROR] at io.quarkus.container.image.deployment.ContainerImageProcessor.publishImageInfo(ContainerImageProcessor.java:52) [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566) [ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:944) [ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277) [ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) [ERROR] at java.base/java.lang.Thread.run(Thread.java:829) [ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501) [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
The text was updated successfully, but these errors were encountered: