Skip to content

Cache Gradle distributions in CI - #953

Merged
DreierF merged 1 commit into
masterfrom
ci/cache-testkit-gradle-distribution
Aug 7, 2026
Merged

Cache Gradle distributions in CI#953
DreierF merged 1 commit into
masterfrom
ci/cache-testkit-gradle-distribution

Conversation

@DreierF

@DreierF DreierF commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Problem

The v37.0.2 tag build failed on the Windows job. All ~24 failing teamscale-gradle-plugin tests shared one root cause:

java.io.IOException: Server returned HTTP response code: 502 for URL:
https://services.gradle.org/distributions/gradle-8.10-bin.zip

The plugin tests run against TeamscalePlugin.MINIMUM_SUPPORTED_VERSION via GradleRunner#withGradleVersion, so TestKit downloads that Gradle distribution at test runtime. gradle/actions/setup-gradle caches only caches and notifications from GRADLE_USER_HOME by default — wrapper is not included — so this ~145 MB download happened on every build, on every OS, with services.gradle.org as a single point of failure.

The same applies to our own wrapper distribution: a run with a warm cache and an unchanged Gradle version still re-downloaded gradle-9.6.1-all.zip on both jobs.

Change

Add wrapper to gradle-home-cache-includes, so the distributions under wrapper/dists are cached.

wrapper/dists/gradle-*-all is excluded: the -all distribution used by our own wrapper is ~570 MB on its own, versus ~145 MB for the -bin one TestKit needs. Excluding it keeps the cache entry reasonable and leaves the wrapper download exactly as it is today.

The step is identical in both jobs, so it is shared with a YAML anchor (&setup-gradle / *setup-gradle). GitHub Actions has supported anchors since September 2025; only merge keys are unsupported, which aliasing a whole step does not need.

Notes

  • cache-read-only: true on tag and PR builds means only a build on master writes the cache, so the first run after merge primes the entry and later runs benefit.
  • Verified locally that the distribution lands in GRADLE_USER_HOME/wrapper/dists (not in a temp directory as I first assumed): with both candidate locations deleted, gradle-8.10-bin reappeared under ~/.gradle/wrapper/dists.
  • Verified the anchor resolves to identical step maps in both jobs, with step counts unchanged.
  • No CHANGELOG entry — CI-only change with no user-visible effect.

🤖 Generated with Claude Code

The teamscale-gradle-plugin tests run against MINIMUM_SUPPORTED_VERSION
via TestKit, which downloads that Gradle distribution into
GRADLE_USER_HOME/wrapper/dists. setup-gradle only caches "caches" and
"notifications" by default, so this ~145 MB download happened on every
build and made the v37.0.2 tag build fail when services.gradle.org
returned HTTP 502.

Add "wrapper" to gradle-home-cache-includes, excluding the "-all"
distribution used by our own wrapper, which alone would add ~570 MB.
The step is shared between both jobs via a YAML anchor.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@DreierF
DreierF enabled auto-merge August 7, 2026 07:15
@DreierF
DreierF merged commit a9af30a into master Aug 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant