Skip to content

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

Open
@snowe2010

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions