Skip to content

Fix cache key identity for SonarHTML - #874

Merged
guillaume-dequenne merged 2 commits into
masterfrom
CLP-900
Sep 30, 2026
Merged

guillaume-dequenne merged 2 commits into
masterfrom
CLP-900

Conversation

@guillaume-dequenne

@guillaume-dequenne guillaume-dequenne commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Part of CLP-900

Give the Linux and Windows build jobs sole ownership of their Maven caches. QA jobs restore the cache without saving it, and the shared Maven actions no longer write a second cache for the same repository.

Validation: PR CI passed, and Linux build, QA, and Windows build restored exact Maven cache keys. In the last 30 days, 9 of 52 commits touched a POM. The new default-branch writer behavior can only be measured when the workflow runs on master.

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Fix cache key identity for SonarHTML CLP-1116 Fix cache key identity for SonarHTML Sep 29, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

CLP-1116

@github-actions

Copy link
Copy Markdown
Contributor

Ruling Report

✅ No changes to ruling expected issues in this PR

@guillaume-dequenne guillaume-dequenne changed the title CLP-1116 Fix cache key identity for SonarHTML Fix cache key identity for SonarHTML Sep 29, 2026
Comment thread .github/workflows/build.yml Resolved
Comment thread .github/workflows/build.yml Resolved
@sonarqube-next

Copy link
Copy Markdown

@guillaume-dequenne
guillaume-dequenne marked this pull request as ready for review September 30, 2026 12:53
@guillaume-dequenne
guillaume-dequenne merged commit 1b253df into master Sep 30, 2026
15 checks passed
@guillaume-dequenne
guillaume-dequenne deleted the CLP-900 branch September 30, 2026 13:46
@gitar-bot

gitar-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 closed / 2 findings

🟡 Medium risk · Changes Maven cache ownership and keys across build and QA workflows.

Fixes Maven cache key identity by giving Linux and Windows build jobs sole ownership of their caches, preventing QA jobs from inadvertently overwriting them. Resolves IT-only dependencies being saved to cache and the maven_cache anchor conflict from #857.

✅ 2 closed
✅ Performance: IT-only Maven dependencies are no longer saved to any cache

📄 .github/workflows/build.yml:78-84 📄 .github/workflows/build.yml:94-102 📄 .github/workflows/build.yml:114-121 📄 .github/workflows/build.yml:138-146 📄 .github/workflows/build.yml:267-273 📄 .github/actions/maven-cache/action.yml:21-35
After this change, only build and build-windows save ~/.m2/repository. They build the root reactor, which contains only sonar-html-plugin (pom.xml:46-48; its is only added by a profile). The qa, qa-dev and ruling jobs run mvn -f its/pom.xml / its/ruling/pom.xml, which pull Orchestrator, SonarLint and other IT dependencies. Those jobs now restore only, and config-maven has disable-caching: 'true', so none of those dependencies are saved anywhere. The same applies to analyze-shadows with -Pcoverage-report. The exact-key hit these jobs get is on a cache that doesn't contain their dependencies, so every run downloads the full IT tree from Artifactory, even on master. Before this PR, the QA jobs' actions/cache step and config-maven's own cache on master could still save them. One fix is to give the IT jobs their own owned cache (for example a separate maven-its-<os>-… key saved by qa). Another is to have the build job resolve IT dependencies (for example mvn -f its/pom.xml dependency:go-offline) before its cache is saved.

✅ Cross-PR: #857's maven_cache anchor conflicts with the new opt-in save contract

📄 .github/workflows/build.yml:30-32 📄 .github/workflows/build.yml:55-57 📄 .github/workflows/build.yml:78-79 📄 .github/actions/maven-cache/action.yml:4-7 📄 .github/actions/maven-cache/action.yml:21-35
This PR (#874, head b977702) adds a save input to .github/actions/maven-cache that defaults to 'false'. The action now writes the cache only when a caller passes save: 'true' on the default branch (action.yml:21-35). It also moves the &maven_cache anchor from the build job to the qa job (build.yml:78). PR #857 at head 486082c still defines &maven_cache with no save input in build (its build.yml:32). It reuses that anchor as *maven_cache in its new scan job (line 70), build-windows (89), qa, qa-dev, ruling and analyze-shadows.

If #857 merges after #874, or is rebased onto it, the two edits to the build job conflict, and each way of resolving it breaks something:

This only happens when both PRs land. The lost cache writes show up only on default-branch runs.

Verification

Functional validation No results

Rules No rules evaluated

Auto-approval Not enabled

Set up

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

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.

2 participants