BUILD-10739 Self-service S3 cache cleanup#41
BUILD-10739 Self-service S3 cache cleanup#41mikolaj-matuszny-ext-sonarsource merged 4 commits intomasterfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
407c113 to
021fddc
Compare
03a70cd to
2c90162
Compare
SummaryAdds a self-service cache cleanup action that lets users delete S3 cache by branch and optional key prefix. Reuses the existing What reviewers should knowStart with: Key logic: The bash script handles both PR-created cache (bare branch names like Wildcard patterns: The script uses Testing limitation: The test added to test-action.yml (test-cleanup-dry-run) is a smoke test only—it runs against a nonexistent branch to verify the action wires up correctly. Actual deletion testing is blocked on SonarSource/github-runners-infra#336 (IAM policy addition). Until that merges, the Cognito role can't do cross-branch deletion. External dependency: The README correctly notes that the IAM PR must be merged and applied first before actual cleanup works in prod.
|
There was a problem hiding this comment.
Conclusion: Clean, well-structured addition that fits naturally into the existing architecture. The dual-form branch search in the cleanup script is the right approach and correctly mirrors how prepare-keys.sh stores cache keys (bare name for PR events, full ref for push events). Ready to merge once SonarSource/github-runners-infra#336 is applied.
2c90162 to
e076b58
Compare
SonarQube reviewer guide
|
SonarQube reviewer guide
|
f35d4d1
into
master




Summary
Adds a self-service cache cleanup composite action (
SonarSource/gh-action_cache/cleanup@v1) that allows users to delete S3 cache entries by branch name and optional key prefix.Usage
Users just provide the branch name as they know it (e.g.,
master,feat/my-branch). The action automatically handles both PR-created and push-created cache entries.What's included
cleanup/action.yml- composite action that handles AWS auth and runs the cleanup scriptscripts/cleanup-cache.sh- cleanup logic usingaws s3 rmwith--include/--excludewildcard patterns.github/workflows/cleanup-cache.yml-workflow_dispatchworkflow for direct trigger from this repoHow it works
S3 cache paths look like:
cache/<org>/<repo>/<hash>/<branch>/<key>The hash prefix is opaque (SHA256 of cache paths + compression + salt), so the script uses
aws s3 rm --recursive --exclude "*" --include "*/<branch>/*"to match across all hash prefixes.Branch names in S3 vary by event type (PRs use bare names like
feat/my-branch, pushes use full refs likerefs/heads/master), so the script searches for both forms automatically.IAM dependency
Requires SonarSource/github-runners-infra#336 to be merged and applied first. The current Cognito role IAM policy scopes
ListBucket/DeleteObjectto the caller's own branch. The IAM PR adds two new statements that allow broader listing/deletion scoped toworkflow_dispatchevents from protected branches only.Test plan
🤖 Generated with Claude Code