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

Gradle Build Cache fails to restore lambda function.zip native executable #36808

Open
snowe2010 opened this issue Oct 31, 2023 · 9 comments
Open
Labels
area/gradle Gradle area/native-image kind/bug Something isn't working

Comments

@snowe2010
Copy link

Describe the bug

./gradlew build --build-cache caches quarkusBuild task, but does not restore native function.zip output, resulting in a build that does not work (native build outputs nothing)

Expected behavior

When running ./gradlew build --build-cache, I would expect gradle to either restore everything that was cached and result in a short build with the correct outputs, or to run tasks that weren't able to be cached, resulting in the correct outputs.

Actual behavior

Testing locally and in CI using the steps detailed in the gradle docs.

I build the project (with the build cache flag enabled), it runs the native graalvm build using docker.
I then run a clean to wipe the build directory
I then rerun the exact same command as the initial build.

I would expect to see the function.zip populate in the build directory, but nothing populates there. Looking at the log, gradle is marking the quarkusBuild task as FROM CACHE which is fine since I didn't change anything, but it should be restoring the function.zip then. But if it can't restore the function.zip (per this PR, this is on purpose) then it should not mark the task as up to date. It is causing complete failure in our CI, since gradle refuses to run the quarkusBuild task, but is also refusing to restore the zip we need to actually deploy.

How to Reproduce?

You can reproduce this with any brand new amazon-lambda project, but here is an attached one just in case you don't want to build a new one.

quarkus-bug-oct-31-2023.zip

Steps:

  1. run ./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true --build-cache
  2. verify that function.zip is in the build folder
  3. run ./gradlew clean --quiet and verify build folder is gone
  4. run ./gradlew build -Dquarkus.package.type=native -Dquarkus.native.container-build=true --build-cache
  5. function.zip will not be present, quarkusBuild will be marked as UP TO DATE even though the outputs are incorrect.

Output of uname -a or ver

Darwin SR-MB-502963 22.6.0 Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "18" 2022-03-22 OpenJDK Runtime Environment (build 18+36-2087) OpenJDK 64-Bit Server VM (build 18+36-2087, mixed mode, sharing)

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

both 2.16.4 and 3.5.0

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

Gradle 8.3

Additional information

No response

Copy link

quarkus-bot bot commented Oct 31, 2023

/cc @Karm (mandrel), @galderz (mandrel), @glefloch, @matejvasek (amazon-lambda), @patriot1burke (amazon-lambda), @quarkusio/devtools, @zakkak (mandrel)

@HipsterZipster
Copy link

@snowe2010 I'm having the same issue! Can you please share how you solved or worked around it?

@snowe2010
Copy link
Author

@HipsterZipster I did not solve it nor work around it. I just can't use the build-cache until this is fixed.

@galderz
Copy link
Member

galderz commented Mar 4, 2024

@snazy Looking at the code you added, the integration would seem to take care of this and so the native runner should be included? https://github.com/quarkusio/quarkus/blame/main/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildCacheableAppParts.java#L43. Can you look into this?

@galderz
Copy link
Member

galderz commented Mar 4, 2024

@HipsterZipster @snowe2010 You could try debugging the builder code with the IDE and see what is going. The above comment hints at some areas that takes care of this.

@snowe2010
Copy link
Author

@galderz I did debug, that's how I found the problem area and the PR.

@ghilainm
Copy link

Same issue here.

@galderz
Copy link
Member

galderz commented Oct 10, 2024

@geoand @gsmet @aloubyansky Can someone help with this?

@geoand
Copy link
Contributor

geoand commented Oct 13, 2024

My knowledge of Gradle is too limited to be of any help here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle area/native-image kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants