Skip to content

Rotate SonarCloud cache key with a content hash - #188

Merged
AndreasIgel merged 2 commits into
java-helpers:mainfrom
AndreasIgel:feature/166-sonar-cache-key-hash
Jul 19, 2026
Merged

AndreasIgel merged 2 commits into
java-helpers:mainfrom
AndreasIgel:feature/166-sonar-cache-key-hash

Conversation

@AndreasIgel

Copy link
Copy Markdown
Collaborator

Upstream counterpart of fork PR AndreasIgel#13. Head branch: AndreasIgel/simple-builders-fork:feature/166-sonar-cache-key-hash → base java-helpers/simple-builders:main.

Summary

Makes the SonarCloud cache self-refreshing.

Fixes #166

The cache key was static (${{ runner.os }}-sonar), so ~/.sonar/cache was written once and only ever restored — the scanner engine/plugins never rotated and a poisoned entry would persist. Now content-addressed:

key: ${{ runner.os }}-sonar-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-sonar-

The restore-keys prefix still gives a warm restore when the hash changes.

Validation

  • actionlint passes.
  • Workflow-only change; Maven build unaffected.

Red build/dependency-review checks are the fork's missing SONAR_TOKEN/CODECOV_TOKEN and disabled Dependency graph — unrelated.

The static ${{ runner.os }}-sonar key never changed, so ~/.sonar/cache
was never refreshed. Key on hashFiles('**/pom.xml') with a prefix
restore-key fallback so the cache stays fresh and self-healing.

Refs java-helpers#166

Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@AndreasIgel
AndreasIgel merged commit ff55ceb into java-helpers:main Jul 19, 2026
5 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the feature/166-sonar-cache-key-hash branch August 16, 2026 21:11
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.

SonarCloud cache key never rotates (static key in maven.yml)

1 participant