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

Building an image with jib fails when adding the quarkus google cloud functions extension #33011

Closed
emilesteenkamp-underpaid opened this issue Apr 29, 2023 · 7 comments · Fixed by #33258

Comments

@emilesteenkamp-underpaid

Describe the bug

After adding the google cloud functions extension to my project, building images with the jib extension failed

Expected behavior

I should still be able to build an image using jib when adding the google cloud functions dependency

Actual behavior

The build fails with exception:

Base image 'registry.access.redhat.com/ubi8/openjdk-17-runtime:1.15' does not use a specific image digest - build may not be reproducible
> Task :quarkusAppPartsBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusAppPartsBuild'.
> There was a failure while executing work items
   > A failure occurred while executing io.quarkus.gradle.tasks.worker.BuildWorker
      > io.quarkus.builder.BuildException: Build failure: Build failed due to errors
                [error]: Build step io.quarkus.container.image.jib.deployment.JibProcessor#buildFromJar threw an exception: java.lang.RuntimeException: Unable to create container image
                at io.quarkus.container.image.jib.deployment.JibProcessor.containerize(JibProcessor.java:255)
                at io.quarkus.container.image.jib.deployment.JibProcessor.buildFromJar(JibProcessor.java:181)
                at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
                at java.base/java.lang.reflect.Method.invoke(Method.java:578)
                at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
                at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
                at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
                at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
                at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
                at java.base/java.lang.Thread.run(Thread.java:1623)
                at org.jboss.threads.JBossThread.run(JBossThread.java:501)
        Caused by: java.util.concurrent.ExecutionException: java.nio.file.NoSuchFileException: /Users/emilesteenkamp/Repository/github.com/emilesteenkamp/quarkus-function-google-function-jib-reproducer/build/lib
                at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:588)
                at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:547)
                at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:91)
                at com.google.cloud.tools.jib.builder.steps.StepsRunner.realizeFutures(StepsRunner.java:112)
                at com.google.cloud.tools.jib.builder.steps.StepsRunner.lambda$buildImage$9(StepsRunner.java:450)
                at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:131)
                at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:74)
                at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:82)
                at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
                at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
                at java.base/java.lang.Thread.run(Thread.java:1623)
        Caused by: java.nio.file.NoSuchFileException: /Users/emilesteenkamp/Repository/github.com/emilesteenkamp/quarkus-function-google-function-jib-reproducer/build/lib
                at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
                at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
                at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
                at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
                at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:171)
                at java.base/java.nio.file.Files.readAttributes(Files.java:1848)
                at java.base/java.nio.file.Files.getLastModifiedTime(Files.java:2391)
                at com.google.cloud.tools.jib.cache.LayerEntriesSelector$LayerEntryTemplate.<init>(LayerEntriesSelector.java:77)
                at com.google.cloud.tools.jib.cache.LayerEntriesSelector.toSortedJsonTemplates(LayerEntriesSelector.java:153)
                at com.google.cloud.tools.jib.cache.LayerEntriesSelector.generateSelector(LayerEntriesSelector.java:169)
                at com.google.cloud.tools.jib.cache.Cache.retrieve(Cache.java:217)
                at com.google.cloud.tools.jib.builder.steps.BuildAndCacheApplicationLayerStep.call(BuildAndCacheApplicationLayerStep.java:102)
                at com.google.cloud.tools.jib.builder.steps.BuildAndCacheApplicationLayerStep.call(BuildAndCacheApplicationLayerStep.java:38)
                ... 6 more


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.


How to Reproduce?

I have added a reproducer project here

https://github.com/emilesteenkamp/quarkus-function-google-function-jib-reproducer

to reproduce the issue, you can clone the project and run the build command in the Readme

Output of uname -a or ver

Darwin Emiles-MacBook-Pro.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "20" 2023-03-21 OpenJDK Runtime Environment Homebrew (build 20) OpenJDK 64-Bit Server VM Homebrew (build 20, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.15.3.Final

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

Gradle 7.5.1

Additional information

No response

@quarkus-bot
Copy link

quarkus-bot bot commented Apr 29, 2023

/cc @geoand (jib), @loicmathieu (google-cloud)

@geoand
Copy link
Contributor

geoand commented May 8, 2023

@loicmathieu, IIUC google-cloud can only work with uber-jar, is that correct?

@loicmathieu
Copy link
Contributor

@geoand yes, and there is no point of using Jib with Google Cloud Functions as a Google Cloud Functions cannot run inside a container but only inside Google Cloud Functions runtime on GCP

@emilesteenkamp-underpaid
Copy link
Author

@loicmathieu In our use case, we want to use the same codebase to deploy to google cloud functions and google cloud run

So we want to use JIB to build the image to deploy to cloud run and for functions we will deploy this as a JAR, using the same codebase

@geoand
Copy link
Contributor

geoand commented May 10, 2023

I'm testing a fix

@loicmathieu
Copy link
Contributor

@emilesteenkamp-underpaid

In our use case, we want to use the same codebase to deploy to google cloud functions and google cloud run

Makes sense.

@geoand

I'm testing a fix

Great :)

@geoand
Copy link
Contributor

geoand commented May 10, 2023

#33258 is what I have in mind (and tested with the sample mentioned here)

geoand added a commit to geoand/quarkus that referenced this issue May 12, 2023
geoand added a commit to geoand/quarkus that referenced this issue May 18, 2023
geoand added a commit that referenced this issue May 18, 2023
Ensure that Google Cloud Functions and Jib extensions work together
@quarkus-bot quarkus-bot bot added this to the 3.2 - main milestone May 18, 2023
@gsmet gsmet modified the milestones: 3.2 - main, 3.1.0.Final May 23, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 23, 2023
@gsmet gsmet modified the milestones: 3.1.0.Final, 3.0.4.Final May 23, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants