jdaugherty opened a new pull request, #15935: URL: https://github.com/apache/grails-core/pull/15935
# fix: make CI dependency caching actually work (branch-keyed jar cache) ## Description CI builds regularly fail when `repo.grails.org` has an outage, because every job downloads its full dependency set from scratch on every run — e.g. [this run](https://github.com/apache/grails-core/actions/runs/28874821760/job/85646947897), where `Build Grails-Core (macos-latest, 21)` failed with `502 Bad Gateway` downloading `groovy-console`/`groovy-swing` jars during `compileGroovy`. Investigation showed that although `setup-gradle` caching is configured, **no Gradle caches exist for this repository at all**: 1. `setup-gradle` only *writes* caches on the repository's default branch (`8.0.x`). All `7.x` branch and PR builds run `cache-read-only: true`, and GitHub's cache scoping only lets them restore from their own branch or the default branch — so the `7.x` branches never have a warm cache. 2. The repo's 10 GB cache quota was exhausted by the `groovy-joint-workflow`, which cached `~/.m2/repository` under a per-SHA key (`cache-local-maven-${{ github.sha }}`). A per-SHA key can never be re-used across runs, so this added a new ~60 MB dead entry on every commit (89 entries at the time of writing), evicting anything useful. This PR fixes both: **`.github/workflows/groovy-joint-workflow.yml`** — remove caching entirely: - The per-SHA Maven-repo cache was really a same-run hand-off of the locally built Groovy from the `build_groovy` job to the `build_grails` job. It is now passed via `upload-artifact`/`download-artifact` (only `~/.m2/repository/org/apache/groovy`, `retention-days: 1`), which is the correct mechanism for job-to-job transfer and does not consume the cache quota. - `cache-disabled: true` on the `setup-gradle` steps — this workflow rebuilds Groovy each run, so a Gradle home cache is not useful. **`.github/workflows/gradle.yml`** — explicit, branch-keyed dependency-jar cache: - `cache-disabled: true` on all `setup-gradle` steps, replacing the action's automatic Gradle-home caching (which was silently doing nothing on `7.x`, and would also cache build outputs). - Every job now has an explicit `actions/cache` step covering **only downloaded dependency jars and wrapper distributions** (`~/.gradle/caches/modules-2`, `~/.gradle/wrapper`) — never Grails build outputs. - The key is based on the branch version: `gradle-deps-<os>-${{ github.base_ref || github.ref_name }}-<hash of dependencies.gradle + gradle-wrapper.properties>`, with a matching `restore-keys` prefix. Pushes to `7.0.x` seed the cache; PRs targeting `7.0.x` restore it. PRs that don't change dependency files get an exact cache hit and skip saving, so PR runs don't pollute the quota. With a warm cache, a transient `repo.grails.org` outage no longer fails the build, and dependency download time is removed from every job. Follow-up (separate PRs): delete the stale `cache-local-maven-*` cache entries so the new caches have room immediately, and add a `mavenCentral()` fallback in `GrailsRepoSettingsPlugin` so a repository outage cannot fail even a cold-cache build. ## Contributor Checklist Please review the following checklist before submitting your pull request. Pull requests that do not meet these requirements may be closed without review. ### Issue and Scope - [ ] This PR is linked to an existing issue that has been **acknowledged or approved** by the project team. If no approved issue exists, please give background on why this change is necessary. Tickets are preferred for release change log history. - No existing issue; background is given above — recurring CI failures caused by `repo.grails.org` outages combined with dependency caching that was configured but never effective. - [x] This PR addresses the **complete scope** of the linked issue. Partial implementations or unfinished work should not be submitted for review. - [x] This PR contains a **single, focused change**. Unrelated changes should be submitted as separate pull requests. - [x] This PR targets the **correct branch** for the type of change: - **Patch release branches** (e.g., `7.0.x`): Bug fixes only. No new features or API changes. - **Minor release branches** (e.g., `7.1.x`): New features are welcome, but breaking existing APIs must be avoided. - **Major release branches** (e.g., `8.0.x`): Reserved for major changes. Breaking API changes are permitted. - CI-infrastructure fix only; no framework code or API changes. Targets `7.0.x` to be merged forward through `7.1.x`/`7.2.x`/`8.0.x`. ### Code Quality - [ ] I have **added or updated tests** that cover the changes introduced in this PR. All code contributions are expected to include appropriate test coverage. - Not applicable — GitHub Actions workflow change only; no framework code is touched. Both workflow files pass YAML validation, and the change is verified by CI itself. - [ ] I have verified that all existing tests pass by running `./gradlew build --rerun-tasks`. - Not applicable — no Gradle-built source is modified; the CI run on this PR exercises the change directly. - [x] My code follows the project's **code style** guidelines. I have run `./gradlew codeStyle` and resolved any violations. See [Code Style](../CONTRIBUTING.md#code-style) for details. - [x] This PR does **not** include mass reformatting, style-only changes, or large-scale refactoring unless it was **explicitly approved** in the linked issue. Unsolicited reformatting will not be accepted. - [x] If generative AI tooling was used in preparing this contribution, a quality model was used to ensure contributions are **consistent with the project's quality standards**. ### Licensing and Attribution - [x] All contributed code is provided under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0), and new source files include the appropriate **Apache license header**. - No new files; the modified workflow files retain their existing Apache license headers. - [x] I have the necessary rights to submit this contribution and confirm it is my own original work (see [Legal Notice](../CONTRIBUTING.md#i-want-to-contribute)). - [x] If generative AI tooling was used in preparing this contribution, I have followed the [Apache Software Foundation's policy on generative tooling](https://www.apache.org/legal/generative-tooling.html) and have properly attributed its use. - This change was prepared with the assistance of Claude Code (Anthropic), including the root-cause investigation of the failing CI run; the approach and final content were reviewed by the contributor. ### Documentation - [ ] If this PR introduces user-facing changes, I have included or updated the relevant documentation. - Not applicable — no user-facing changes. - [ ] If this PR adds a new feature, I have updated the **What's New** section of the Grails Guide. - Not applicable. - [ ] If this PR introduces breaking changes or changes that require user action during an upgrade, I have updated the **Upgrade Notes** for the corresponding version in the Grails Guide. - Not applicable. - [x] The PR description clearly explains **what** was changed and **why**. --- > **First-time contributors:** Please read our [Contributing Guide](../CONTRIBUTING.md) before submitting. > Pull requests that appear to be auto-generated, incomplete, or unrelated to an approved issue may be > closed to help maintainers focus on reviewed and planned work. We appreciate your understanding. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
