Skip to content

chore(ci): allow failed test jobs to restore the cache on retry [EXT-00] - #2977

Open
Jared Jolton (jjolton-contentful) wants to merge 1 commit into
masterfrom
fix/ci/allow-retry-from-failed-to-restore-cache
Open

chore(ci): allow failed test jobs to restore the cache on retry [EXT-00]#2977
Jared Jolton (jjolton-contentful) wants to merge 1 commit into
masterfrom
fix/ci/allow-retry-from-failed-to-restore-cache

Conversation

@jjolton-contentful

@jjolton-contentful Jared Jolton (jjolton-contentful) commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix the CI build cache key so rerunning failed jobs can restore the existing dist cache.

Description

This removes github.run_attempt from the build cache key in the reusable workflows, while keeping the cache scoped to the current workflow run via github.run_id.

Motivation and Context

Our integration jobs could not be rerun in GitHub because the cache restore step was using an attempt-specific key with fail-on-cache-miss: true. This keeps the same run-scoped cache available across reruns of failed jobs.

Tip

This is safe because the cache is still scoped to the current workflow run via github.run_id. We’re only removing github.run_attempt so rerun attempts can reuse the original build output instead of failing on a cache miss.

Summary by Bito

This PR updates GitHub Actions cache key configuration across five CI workflow files to allow failed integration jobs to be rerun and restore the existing build cache. By removing `github.run_attempt` from the cache key pattern, the same cache can be accessed across multiple retry attempts within the same workflow run.

Detailed Changes
  • Removes `${{ github.run_attempt }}` from the build cache key in all five workflow files, changing the format from `build-cache-${{ github.run_id }}-${{ github.run_attempt }}` to `build-cache-${{ github.run_id }}`
  • Enables failed CI jobs to restore the existing `dist` directory cache when rerun, rather than failing on cache miss due to the attempt-specific key
  • Maintains cache isolation to the current workflow run via `github.run_id`, ensuring different workflow executions don't share caches

@bito-code-review

bito-code-review Bot commented Apr 10, 2026

Copy link
Copy Markdown

Code Review Agent Run #19512c

Actionable Suggestions - 0
Review Details
  • Files reviewed - 5 · Commit Range: 335ac15..335ac15
    • .github/workflows/build.yaml
    • .github/workflows/check.yaml
    • .github/workflows/release.yaml
    • .github/workflows/test-demo-projects.yaml
    • .github/workflows/test-integration.yaml
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review

bito-code-review Bot commented Apr 10, 2026

Copy link
Copy Markdown

Changelist by Bito

This pull request implements the following key changes.

Key Change Files Impacted Summary
Feature Improvement - CI Cache Key Fix for Job Retry Support
Removes `${{ github.run_attempt }}` from build cache keys across all CI workflows, enabling failed jobs to restore the existing `dist` cache on retry while maintaining workflow-run isolation via `github.run_id`.

@bito-code-review

bito-code-review Bot commented Apr 10, 2026

Copy link
Copy Markdown

Impact Analysis by Bito

Interaction Diagram
sequenceDiagram
participant Dev as Developer
participant GH as GitHub Actions
participant BW as Build Workflow<br/>🔄 Updated | ●●● High
participant CW as Check Workflow<br/>🔄 Updated | ●●● High
participant RW as Release Workflow<br/>🔄 Updated | ●●● High
participant TW as Test Workflows<br/>🔄 Updated | ●●● High
participant AC as Actions Cache
participant Dist as Build Artifacts
Dev->>GH: Push code / Create PR
GH->>BW: Trigger build workflow
BW->>Dist: Build and save artifacts
BW->>AC: Save cache with key build-cache-$&#123;&#123; github.run_id &#125;&#125;
AC-->>BW: Cache saved
GH->>CW: Trigger check workflow
CW->>AC: Restore cache with key build-cache-$&#123;&#123; github.run_id &#125;&#125;
AC-->>CW: Cache restored
CW->>Dist: Access build artifacts
CW->>CW: Run lint, format, unit tests
GH->>TW: Trigger test workflows
TW->>AC: Restore cache with key build-cache-$&#123;&#123; github.run_id &#125;&#125;
AC-->>TW: Cache restored
TW->>Dist: Access build artifacts
TW->>TW: Run integration tests
GH->>RW: Trigger release workflow
RW->>AC: Restore cache with key build-cache-$&#123;&#123; github.run_id &#125;&#125;
AC-->>RW: Cache restored
RW->>Dist: Access build artifacts
RW->>RW: Run semantic release
Note over BW, TW: Cache key simplified by removing run_attempt suffix
Note over BW, TW: Enables cache reuse across workflow retries
Loading

This MR simplifies the GitHub Actions cache key by removing the run_attempt suffix from build-cache keys across all workflows. This allows build artifacts to be reused when workflows are retried, improving CI efficiency. The change affects the Build, Check, Release, and Test workflows that share the dist folder cache.

Cross-Repository Impact Analysis
What Changed Impact of Change Suggested Review Actions
GitHub Actions cache key format changed from 'build-cache-${{ github.run_id }}-${{ github.run_attempt }}' to 'build-cache-${{ github.run_id }}' across 5 workflow files - intra-repo: CI/CD workflows: Cache keys no longer include run_attempt, meaning cache collisions may occur between workflow re-runs. Multiple attempts of the same workflow run will share the same cache key. - Verify that cache sharing between workflow re-runs is intentional and safe
- Check if any workflows rely on run_attempt isolation for cache correctness
- Test workflow re-runs to ensure cached artifacts are compatible across attempts
Code Paths Analyzed

Impact:
CI/CD infrastructure change affecting GitHub Actions cache key generation. Cache keys are simplified by removing run_attempt suffix, allowing cache reuse between workflow re-runs.

Flow:
GitHub workflow trigger → actions/cache step → cache key resolution → artifact storage/retrieval

Direct Changes (Diff Files):
• .github/workflows/build.yaml [9-10] — Removed run_attempt from cache key
• .github/workflows/check.yaml [20-21] — Removed run_attempt from cache key
• .github/workflows/release.yaml [34-35] — Removed run_attempt from cache key
• .github/workflows/test-demo-projects.yaml [48-49] — Removed run_attempt from cache key
• .github/workflows/test-integration.yaml [62-63] — Removed run_attempt from cache key

Repository Impact:
CI/CD pipeline caching behavior: All workflows using build cache will now share cache across re-runs of the same workflow run ID

Cross-Repository Dependencies:
None.

Database/Caching Impact:
• None

API Contract Violations:
None.

Infrastructure Dependencies:
• GitHub Actions caching infrastructure
• actions/cache GitHub Action

Additional Insights:
Build performance: Cache hits may increase between re-runs since cache key is now stable across attempts
Cache invalidation: If a workflow run produces a bad cache, re-running won't create a fresh cache - manual cache deletion may be needed

Testing Recommendations

Frontend Impact:
None.

Service Integration:
None.

Data Serialization:
None.

Privacy Compliance:
None.

Backward Compatibility:
• Verify cached build artifacts are compatible across workflow re-runs
• Test that re-running a failed workflow doesn't propagate stale cache state

OAuth Functionality:
• None

Reliability Testing:
• None

Additional Insights:
• Run a test workflow, then re-run it to verify cache sharing works correctly
• Check if any workflow steps depend on run_attempt-specific cache isolation
• Document the cache key change in release notes if this affects developer workflows

Analysis based on known dependency patterns and edges. Actual impact may vary.

@jjolton-contentful
Jared Jolton (jjolton-contentful) force-pushed the fix/ci/allow-retry-from-failed-to-restore-cache branch from 335ac15 to e2908a1 Compare May 11, 2026 19:33
@bito-code-review

bito-code-review Bot commented May 11, 2026

Copy link
Copy Markdown

Code Review Agent Run #ed746e

Actionable Suggestions - 0
Review Details
  • Files reviewed - 5 · Commit Range: e2908a1..e2908a1
    • .github/workflows/build.yaml
    • .github/workflows/check.yaml
    • .github/workflows/release.yaml
    • .github/workflows/test-demo-projects.yaml
    • .github/workflows/test-integration.yaml
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

@jjolton-contentful
Jared Jolton (jjolton-contentful) force-pushed the fix/ci/allow-retry-from-failed-to-restore-cache branch from e2908a1 to cb3944a Compare July 24, 2026 17:55

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Agent Run #bda024

Actionable Suggestions - 1
  • .github/workflows/release.yaml - 1
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • .github/workflows/test-integration.yaml - 1
  • .github/workflows/check.yaml - 1
Review Details
  • Files reviewed - 5 · Commit Range: cb3944a..cb3944a
    • .github/workflows/build.yaml
    • .github/workflows/check.yaml
    • .github/workflows/release.yaml
    • .github/workflows/test-demo-projects.yaml
    • .github/workflows/test-integration.yaml
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread .github/workflows/release.yaml
@jjolton-contentful

Copy link
Copy Markdown
Contributor Author

/resolve

@jjolton-contentful

Copy link
Copy Markdown
Contributor Author

/resolve

@jjolton-contentful

Copy link
Copy Markdown
Contributor Author

/review

Context for re-review: the prior change request about keeping run_attempt in the cache key is intentionally declined. Removing run_attempt is the purpose of this PR — so a failed job retry can restore the cache from the same run_id. Please re-approve if there are no other actionable issues.

@bito-code-review

Copy link
Copy Markdown

AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).

@jjolton-contentful

Copy link
Copy Markdown
Contributor Author

/abort

@jjolton-contentful
Jared Jolton (jjolton-contentful) force-pushed the fix/ci/allow-retry-from-failed-to-restore-cache branch from cb3944a to e724211 Compare July 27, 2026 20:20

@bito-code-review bito-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Agent Run #968484

Actionable Suggestions - 1
  • .github/workflows/build.yaml - 1
    • Cache key removes attempt isolation · Line 39-39
Additional Suggestions - 1
  • .github/workflows/check.yaml - 1
    • Cache key fix verified correct · Line 31-31
      Intentional change. The previous restore key `build-cache-${{ github.run_id }}-${{ github.run_attempt }}` never matched the save key `build-cache-${{ github.run_id }}` (build.yaml line 39), causing cache misses on every run. This change removes `-${{ github.run_attempt }}` so restore keys match save keys, enabling cache hits on workflow retries as intended by the commit.
Review Details
  • Files reviewed - 5 · Commit Range: e724211..e724211
    • .github/workflows/build.yaml
    • .github/workflows/check.yaml
    • .github/workflows/release.yaml
    • .github/workflows/test-demo-projects.yaml
    • .github/workflows/test-integration.yaml
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread .github/workflows/build.yaml
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