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

Native Image Build - Reuse-Existing requires docker runtime #27479

Closed
Diom opened this issue Aug 24, 2022 · 4 comments · Fixed by #27492
Closed

Native Image Build - Reuse-Existing requires docker runtime #27479

Diom opened this issue Aug 24, 2022 · 4 comments · Fixed by #27492
Labels
area/container-image kind/bug Something isn't working
Milestone

Comments

@Diom
Copy link

Diom commented Aug 24, 2022

Describe the bug

I am attempting to develop a two part Quarkus CI Pipeline in Jenkins. The process is to build the core artifact and then run the image build and push per target registry. So:

  1. Build Artifact with Tests and Reports (docker agent)
  2. Build the image (node agent with docker install)
  3. Push to Reg1 (docker agent)
  4. Push to Reg2 (docker agent)

This works fine for JVM builds but fails for Native Images.

During Stage 2 I build the native executable when a 'Native' parameter is set. For Stages 3 & 4, I use a command like so:

mvn package $MVN_OPTS -DskipTests -Dquarkus.container-image.build=true \
    -Dquarkus.container-image.builder=jib \
    -Dquarkus.container-image.push=true \
    -Dquarkus.container-image.tag=$tag \
    -Dquarkus.container-image.registry=$registry \
    -Dquarkus.native.reuse-existing=true -Pnative

Expected behavior

I expect that the JIB builder will construct the image, set the correct entrypoint and push the image to registry without requiring an intermediate container-runtime

Actual behavior

The build fails

17:26:32  Caused by: java.lang.IllegalStateException: No container runtime was found to run the native image builder. Make sure you have Docker or Podman installed in your environment.
17:26:32      at io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner.detectContainerRuntime (NativeImageBuildContainerRunner.java:151)
17:26:32      at java.util.Optional.orElseGet (Optional.java:369)
17:26:32      at io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner.<init> (NativeImageBuildContainerRunner.java:33)
17:26:32      at io.quarkus.deployment.pkg.steps.NativeImageBuildLocalContainerRunner.<init> (NativeImageBuildLocalContainerRunner.java:19)
17:26:32      at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.getNativeImageBuildRunner (NativeImageBuildStep.java:291)
17:26:32      at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build (NativeImageBuildStep.java:177)
17:26:32      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
17:26:32      at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
17:26:32      at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
17:26:32      at java.lang.reflect.Method.invoke (Method.java:566)
17:26:32      at io.quarkus.deployment.ExtensionLoader$2.execute (ExtensionLoader.java:887)
17:26:32      at io.quarkus.builder.BuildContext.run (BuildContext.java:277)
17:26:32      at org.jboss.threads.ContextHandler$1.runWith (ContextHandler.java:18)
17:26:32      at org.jboss.threads.EnhancedQueueExecutor$Task.run (EnhancedQueueExecutor.java:2449)
17:26:32      at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1478)
17:26:32      at java.lang.Thread.run (Thread.java:829)
17:26:32      at org.jboss.threads.JBossThread.run (JBossThread.java:501)

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

Java version: 11.0.16, vendor: Oracle Corporation, runtime: /usr/local/openjdk-11

GraalVM version (if different from Java)

Container Build

Quarkus version or git rev

2.6.3.Final

Build tool (ie. output of mvnw --version or gradlew --version)

maven:3.8.6

Additional information

No response

@Diom Diom added the kind/bug Something isn't working label Aug 24, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 24, 2022

/cc @geoand

@Diom Diom changed the title Native Image Build - Resuse-Existing with Container-Image JIB builder & push still requires docker runtime Native Image Build - Reuse-Existing with Container-Image JIB builder & push still requires docker runtime Aug 24, 2022
@geoand
Copy link
Contributor

geoand commented Aug 24, 2022

This isn't Jib that is failing, it's the native image generation, which is attempting to build the native binary using docker or podman because GraalVM is not installed locally

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Aug 24, 2022
@geoand geoand added the triage/invalid This doesn't seem right label Aug 24, 2022
@Diom
Copy link
Author

Diom commented Aug 24, 2022

@geoand Yes, but isn't that a problem given that the native executable already exists and the quarkus.native.reuse-existing flag has been set? With this set of parameters I would expect that:

  1. The native artifact does not need to be created, so no GraalVM execution or Docker container is required
  2. The JIB flag is set so no need for docker to build the image
  3. quarkus.container-image.push (and registry) is set, so no need to push into the local docker daemon.

This is why I think that it is a bug

@geoand
Copy link
Contributor

geoand commented Aug 25, 2022

Actually, that's a very good point.

@geoand geoand reopened this Aug 25, 2022
@quarkus-bot quarkus-bot bot removed the triage/invalid This doesn't seem right label Aug 25, 2022
geoand added a commit to geoand/quarkus that referenced this issue Aug 25, 2022
@geoand geoand changed the title Native Image Build - Reuse-Existing with Container-Image JIB builder & push still requires docker runtime Native Image Build - Reuse-Existing requires docker runtime Aug 25, 2022
geoand added a commit that referenced this issue Aug 29, 2022
Ensure that quarkus.native.reuse-existing=true does not fail if GraalVM is not present
@quarkus-bot quarkus-bot bot added this to the 2.13 - main milestone Aug 29, 2022
fercomunello pushed a commit to fercomunello/quarkus that referenced this issue Aug 31, 2022
@gsmet gsmet modified the milestones: 2.13 - main, 2.12.1.Final Sep 5, 2022
gsmet pushed a commit to gsmet/quarkus that referenced this issue Sep 5, 2022
evanchooly pushed a commit to nenros/quarkus that referenced this issue Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/container-image kind/bug Something isn't working
Projects
None yet
3 participants