PREQ-6373: Store build-number cache in S3 via runs-on/cache split#299
PREQ-6373: Store build-number cache in S3 via runs-on/cache split#299matemoln wants to merge 1 commit into
Conversation
Replace actions/cache restore/save with gh-action_cache credential-setup and runs-on/cache split steps so build numbers persist in SonarSource S3 across jobs, runner types, and OSes within a workflow run. Use branch-prefixed S3 keys matching gh-action_cache conventions. Re-enable strict cross-job reuse assertions in the Test Build Number workflow.
|
| env: | ||
| RUNS_ON_S3_BUCKET_CACHE: sonarsource-s3-cache-prod-bucket | ||
| AWS_DEFAULT_REGION: eu-central-1 | ||
| AWS_REGION: eu-central-1 | ||
| AWS_ACCESS_KEY_ID: ${{ steps.aws-auth.outputs.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ steps.aws-auth.outputs.AWS_SECRET_ACCESS_KEY }} | ||
| AWS_SESSION_TOKEN: ${{ steps.aws-auth.outputs.AWS_SESSION_TOKEN }} | ||
| AWS_PROFILE: '' | ||
| AWS_DEFAULT_PROFILE: '' |
There was a problem hiding this comment.
💡 Quality: Duplicated AWS credential env across restore/save steps
The full AWS credential/config env block (RUNS_ON_S3_BUCKET_CACHE, AWS_DEFAULT_REGION, AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_PROFILE, AWS_DEFAULT_PROFILE) is copy-pasted verbatim into both the Get cached build number (restore) step and the Save build number to cache step in get-build-number/action.yml. Any future change (bucket name, region) must be edited in two places, creating a drift risk where restore and save could end up pointing at different buckets/regions and silently miss the cache. Composite actions don't support job-level env, but you can reduce duplication by setting the static values once via $GITHUB_ENV in the existing Set local action paths step (e.g. RUNS_ON_S3_BUCKET_CACHE, AWS_*_REGION) and only repeating the per-step credential outputs, or by factoring the cache logic out. At minimum, keep the two blocks identical to avoid restore/save mismatches.
Was this helpful? React with 👍 / 👎
CI failed: The transition to S3-based caching for build numbers is causing cross-job state synchronization failures, leading to test regressions where sequential jobs fetch inconsistent build numbers.OverviewThe PR changes the build-number cache implementation to use S3, but this has caused consistent failures in cross-job cache synchronization. Across 3 analyzed logs, tests in both Windows and Linux environments are failing to retrieve the previously cached build number, resulting in build number mismatches (e.g., getting 3885 instead of 3884). FailuresBuild Number Cache Discrepancy (confidence: high)
Summary
Code Review 👍 Approved with suggestions 0 resolved / 1 findingsMigration to S3-backed caching for build numbers improves cross-job reliability and re-enables strict failure checks. Consolidate duplicated AWS credential environment variables into a reusable template to reduce step configuration verbosity. 💡 Quality: Duplicated AWS credential env across restore/save steps📄 get-build-number/action.yml:55-63 📄 get-build-number/action.yml:95-103 The full AWS credential/config env block (RUNS_ON_S3_BUCKET_CACHE, AWS_DEFAULT_REGION, AWS_REGION, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_PROFILE, AWS_DEFAULT_PROFILE) is copy-pasted verbatim into both the 🤖 Prompt for agentsTip Comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |



Summary
actions/cache/restore+actions/cache/saveinget-build-numberwithgh-action_cache/credential-setupandruns-on/cache/restore+runs-on/cache/save, storing build numbers in SonarSource S3 (sonarsource-s3-cache-prod-bucket){github.head_ref || github.ref}/build-number-{run_id}) aligned withgh-action_cacheS3 layout.build_number.txtis removed from the workspace after saveexit 1on cross-job reuse mismatches inTest Build Number(previously commented out as flaky under GitHub Actions cache)Test plan
Test Build Numberworkflow passes (generation, same-job stability, cross-job Linux reuse, cross-OS Windows reuse, env bypass)id-token: writepermission