Skip to content

BUILD-10724: GitHub→S3 cache migration fallback#125

Merged
julien-carsique-sonarsource merged 2 commits intomasterfrom
test/jcarsique/BUILD-10724-migrationGh2s3
Mar 26, 2026
Merged

BUILD-10724: GitHub→S3 cache migration fallback#125
julien-carsique-sonarsource merged 2 commits intomasterfrom
test/jcarsique/BUILD-10724-migrationGh2s3

Conversation

@julien-carsique-sonarsource
Copy link
Copy Markdown
Contributor

@julien-carsique-sonarsource julien-carsique-sonarsource commented Mar 18, 2026

Tests the import-github-cache feature introduced in SonarSource/gh-action_cache#45
Also depends on SonarSource/ci-github-actions#236

Migrate sonar-dummy-js to S3 cache

What is being tested

Scenario Description
test-s3-import-enabled S3 backend, import mode active (default) — migration fallback in action
test-s3-import-disabled S3 backend, import-github-cache: false — post-migration behaviour
test-s3-import-disabled-via-env S3 backend, CACHE_IMPORT_GITHUB=false env var — repo variable pattern

Related

@julien-carsique-sonarsource
Copy link
Copy Markdown
Contributor Author

julien-carsique-sonarsource commented Mar 24, 2026

https://github.com/SonarSource/sonar-dummy-js/actions/runs/23494106215/job/68370132963?pr=125
✔️ Migration success in the first run.

# Build
## S3 backend and import mode ON
Using default import mode: true

## S3 lookup
Cache not found for input keys: test/jcarsique/BUILD-10724-migrationGh2s3/npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0, test/jcarsique/BUILD-10724-migrationGh2s3/npm-Linux-Build-

## GitHub lookup
Cache hit for: npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0
Cache restored from key: npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0

## Post Run
Cache saved with key: test/jcarsique/BUILD-10724-migrationGh2s3/npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0
---
# Custom NPM command
## S3 lookup
Cache restored from key: test/jcarsique/BUILD-10724-migrationGh2s3/npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0

## Post Run
Cache hit occurred on the primary key test/jcarsique/BUILD-10724-migrationGh2s3/npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0, not saving cache.

✔️ No need for migration in the second run.

# Build
## S3 lookup
Cache restored successfully
Cache restored from key: test/jcarsique/BUILD-10724-migrationGh2s3/npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0

## Post Run
Cache hit occurred on the primary key test/jcarsique/BUILD-10724-migrationGh2s3/npm-Linux-Build-655c2e22a7bceb4cba87bd33429d34e2ab54e41f19dab78fad56d9bc645173e0, not saving cache.

@julien-carsique-sonarsource julien-carsique-sonarsource force-pushed the test/jcarsique/BUILD-10724-migrationGh2s3 branch from 62396c0 to d2e1fcf Compare March 25, 2026 10:13
@julien-carsique-sonarsource julien-carsique-sonarsource changed the title [TEST] BUILD-10724: GitHub→S3 cache migration fallback BUILD-10724: GitHub→S3 cache migration fallback Mar 25, 2026
Tests the new import-github-cache feature from gh-action_cache:
- S3 backend with import mode active (default migration behaviour)
- S3 backend with import mode explicitly disabled (post-migration)
- S3 backend with import mode disabled via CACHE_IMPORT_GITHUB env var

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@julien-carsique-sonarsource julien-carsique-sonarsource force-pushed the test/jcarsique/BUILD-10724-migrationGh2s3 branch from d2e1fcf to 0f073d2 Compare March 25, 2026 16:58
@julien-carsique-sonarsource julien-carsique-sonarsource marked this pull request as ready for review March 25, 2026 17:44
Copilot AI review requested due to automatic review settings March 25, 2026 17:44
@sonar-review-alpha
Copy link
Copy Markdown

sonar-review-alpha bot commented Mar 25, 2026

Summary

Tests the migration fallback mechanism for the cache backend transition (GitHub → S3). A new workflow validates three scenarios: (1) S3 with GitHub cache import enabled (default, tests the fallback feature), (2) S3 with import explicitly disabled, and (3) S3 with import disabled via environment variable. The test provisions a GitHub cache entry, then verifies that each scenario behaves correctly. Also updates existing workflows to force S3 backend globally.

What reviewers should know

Start here: Review the new test-cache-migration-gh2s3.yml workflow to understand what's being validated. The test design is clever: it uses provision-github-cache to create a shared GitHub cache entry that scenarios 1–3 then attempt to restore under different configurations. Key details: (1) Scenario 1 succeeds (cache-hit: true) because import is enabled by default—this verifies the fallback works. (2) Scenarios 2 and 3 intentionally fail to import to verify the migration is complete. (3) The rm -rf ~/.npm cleanup in scenario 1 prevents test pollution. (4) Two disable patterns are tested to support both explicit configuration and environment variables (useful for repos using GitHub environment variables). The CACHE_BACKEND: s3 env var in build.yml and unified-dogfooding.yml ensures all cache steps use S3, including those from reused actions.


  • Generate Walkthrough
  • Generate Diagram

🗣️ Give feedback

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds workflows and configuration to dogfood and validate the GitHub→S3 cache migration fallback behavior for SonarSource/gh-action_cache, while switching this repo’s CI workflows to force the S3 cache backend.

Changes:

  • Force S3 caching in existing CI workflows via workflow-level CACHE_BACKEND: s3.
  • Add a dedicated test workflow to exercise migration fallback and import-disabled modes (including env-var disabling).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/unified-dogfooding.yml Forces S3 cache backend for unified dogfooding runs via CACHE_BACKEND.
.github/workflows/build.yml Forces S3 cache backend for build pipeline via CACHE_BACKEND.
.github/workflows/test-cache-migration-gh2s3.yml Adds a test matrix-style workflow to validate GitHub→S3 import fallback and disabling mechanisms.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

@bwalsh434 bwalsh434 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, more tests 👍

Copy link
Copy Markdown

@sonar-review-alpha sonar-review-alpha bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conclusion: Clean, well-structured PR. The production changes are minimal (two one-liner env additions), and the test workflow is thorough and correctly designed for its purpose.

🗣️ Give feedback

@julien-carsique-sonarsource julien-carsique-sonarsource force-pushed the test/jcarsique/BUILD-10724-migrationGh2s3 branch from 0f073d2 to 0406398 Compare March 26, 2026 09:58
@sonarqube-next
Copy link
Copy Markdown

Quality Gate passed Quality Gate passed for 'sonar-dummy-js'

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
0 Dependency risks
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@julien-carsique-sonarsource julien-carsique-sonarsource merged commit 3c7a60a into master Mar 26, 2026
9 of 10 checks passed
@julien-carsique-sonarsource julien-carsique-sonarsource deleted the test/jcarsique/BUILD-10724-migrationGh2s3 branch March 26, 2026 10:04
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.

3 participants