Speed up the java_sdk e2e Gradle builds with concurrency and caching#69239
Conversation
The example and scala_spark_example bundles are independent Gradle builds that both consume the SDK artifact published to the local Maven repo, so the Scala Spark dependency resolution no longer has to wait for the Java example build to finish before it starts. The bundle containers run with --network=host because Gradle's cross-process lock handover pings the lock owner over loopback, which isolated container network namespaces would break, and each build's output is captured and printed under its own header so concurrent logs do not interleave.
The java_sdk e2e job builds the SDK and its example bundles with Gradle on every canary and java-sdk-touching run, starting from an empty GRADLE_USER_HOME each time. That forces a full re-download of the example bundles' dependency tree (Spark alone is around 1GB) on every run. Reusing the resolved dependencies across runs removes that repeated download. The restore/save split saves the warm-up even when the e2e tests fail, the key hashes the Kotlin-DSL build files and version catalog that pin the SDK dependencies, and runner.arch keeps the arch-specific auto-provisioned JDKs in .gradle/jdks from crossing between amd64 and arm64 runners.
Excludes churny *.lock/journal files from the Gradle cache per GitHub's own caching guidance, makes bundle build output print stdout/stderr symmetrically through Rich with markup disabled so raw Gradle text can't be misparsed as markup, ties the build pool size to the bundle list instead of a hardcoded count, and cites the Gradle lock-handover mechanism the --network=host workaround depends on.
f5be378 to
f0287aa
Compare
|
#69411 introduced a different approach to caching, we might want to think about this with both in context. This does not block the merge since the two are fundamentally different components and don’t conflict. |
Backport failed to create: v3-3-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 7a4c059 v3-3-testThis should apply the commit to the v3-3-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
Yes, I will follow-up to check whether building Java-SDK artifact natively in CI be better (it should but still worthwhile to double check). No need to backport, Lang-SDK lives in main. |
The java_sdk e2e mode and the lang-SDK k8s test solved the same cold-build problem two different ways (containerized Gradle with a repo-local cache vs host toolchain with salted home-dir caches), which a review follow-up on apache#69239 asked to reconcile. Converge the e2e mode on the apache#69411 native-toolchain convention: CI provisions the JDK with actions/setup-java and caches ~/.gradle, dropping the per-run eclipse-temurin image pull and the --network=host Gradle lock-handover workaround; local runs keep the containerized build so a dev host still needs no JDK.
The java_sdk e2e mode and the lang-SDK k8s test solved the same cold-build problem two different ways (containerized Gradle with a repo-local cache vs host toolchain with salted home-dir caches), which a review follow-up on apache#69239 asked to reconcile. Converge the e2e mode on the apache#69411 native-toolchain convention: CI provisions the JDK with actions/setup-java and caches ~/.gradle, dropping the per-run eclipse-temurin image pull and the --network=host Gradle lock-handover workaround; local runs keep the containerized build so a dev host still needs no JDK.
The java_sdk e2e mode and the lang-SDK k8s test solved the same cold-build problem two different ways (containerized Gradle with a repo-local cache vs host toolchain with salted home-dir caches), which a review follow-up on apache#69239 asked to reconcile. Converge the e2e mode on the apache#69411 native-toolchain convention: CI provisions the JDK with actions/setup-java and caches ~/.gradle, dropping the per-run eclipse-temurin image pull and the --network=host Gradle lock-handover workaround; local runs keep the containerized build so a dev host still needs no JDK.
The java_sdk e2e mode and the lang-SDK k8s test solved the same cold-build problem two different ways (containerized Gradle with a repo-local cache vs host toolchain with salted home-dir caches), which a review follow-up on #69239 asked to reconcile. Converge the e2e mode on the #69411 native-toolchain convention: CI provisions the JDK with actions/setup-java and caches ~/.gradle, dropping the per-run eclipse-temurin image pull and the --network=host Gradle lock-handover workaround; local runs keep the containerized build so a dev host still needs no JDK.
…pache#69239) * Build the Java SDK and Scala Spark e2e bundles concurrently The example and scala_spark_example bundles are independent Gradle builds that both consume the SDK artifact published to the local Maven repo, so the Scala Spark dependency resolution no longer has to wait for the Java example build to finish before it starts. The bundle containers run with --network=host because Gradle's cross-process lock handover pings the lock owner over loopback, which isolated container network namespaces would break, and each build's output is captured and printed under its own header so concurrent logs do not interleave. * Cache the Java SDK Gradle dependencies in the e2e job The java_sdk e2e job builds the SDK and its example bundles with Gradle on every canary and java-sdk-touching run, starting from an empty GRADLE_USER_HOME each time. That forces a full re-download of the example bundles' dependency tree (Spark alone is around 1GB) on every run. Reusing the resolved dependencies across runs removes that repeated download. The restore/save split saves the warm-up even when the e2e tests fail, the key hashes the Kotlin-DSL build files and version catalog that pin the SDK dependencies, and runner.arch keeps the arch-specific auto-provisioned JDKs in .gradle/jdks from crossing between amd64 and arm64 runners. * Address java_sdk e2e review feedback on caching and build output Excludes churny *.lock/journal files from the Gradle cache per GitHub's own caching guidance, makes bundle build output print stdout/stderr symmetrically through Rich with markup disabled so raw Gradle text can't be misparsed as markup, ties the build pool size to the bundle list instead of a hardcoded count, and cites the Gradle lock-handover mechanism the --network=host workaround depends on.
The java_sdk e2e mode and the lang-SDK k8s test solved the same cold-build problem two different ways (containerized Gradle with a repo-local cache vs host toolchain with salted home-dir caches), which a review follow-up on apache#69239 asked to reconcile. Converge the e2e mode on the apache#69411 native-toolchain convention: CI provisions the JDK with actions/setup-java and caches ~/.gradle, dropping the per-run eclipse-temurin image pull and the --network=host Gradle lock-handover workaround; local runs keep the containerized build so a dev host still needs no JDK.
Why
The java_sdk e2e job builds the two example bundles sequentially and starts from an empty
GRADLE_USER_HOMEon every run, forcing a full re-download of the bundles' dependency tree (Spark alone is ~1GB) each time.What
exampleandscala_spark_examplebundles concurrently; they are independent Gradle builds that both only consume the SDK artifact published beforehand.--network=host: Gradle's cross-process lock handover pings the lock owner over loopback, which isolated container network namespaces would break (60s lock timeouts).java-sdk/.gradle(caches, wrapper, jdks) in the e2e workflow for the java_sdk mode.actions/cache/restore+actions/cache/savesplit withif: always(), so a completed Gradle warm-up is saved even when the e2e tests later fail.runner.archso arch-specific auto-provisioned JDKs do not cross between amd64 and arm64 runners.Was generative AI tooling used to co-author this PR?