Skip to content

fix(ci): [#3019] build without sccache when its server does not start - #3040

Merged
josecelano merged 6 commits into
torrust:developfrom
josecelano-bot:3019-ci-sccache-startup-fallback
Nov 25, 2026
Merged

josecelano merged 6 commits into
torrust:developfrom
josecelano-bot:3019-ci-sccache-startup-fallback

Conversation

@josecelano-bot

@josecelano-bot josecelano-bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bare CI builds now keep building, without the compilation cache, when the sccache server does not start. Before this change, a slow GitHub Actions cache service made the server miss sccache's 10-second startup timeout, and the first cargo command failed the job with sccache: error: Timed out waiting for server startup (four jobs on 2026-11-23).

Changes

  • New local composite action .github/actions/enable-sccache, run after mozilla-actions/sccache-action:
    • runs sccache --start-server with SCCACHE_GHA_ENABLED=true and SCCACHE_IDLE_TIMEOUT=0, because the server selects its cache backend when it starts;
    • on success, exports RUSTC_WRAPPER=sccache, SCCACHE_GHA_ENABLED=true and SCCACHE_IDLE_TIMEOUT=0 (the server then lives for the whole job, so no later compile starts one without this check);
    • on failure, stops any late server, exports nothing for sccache and shows a sccache disabled warning annotation;
    • exports CARGO_INCREMENTAL=0 in both cases. It uses shell: bash, so it also runs on the windows-latest jobs.
  • The nine Enable sccache steps in testing.yaml, os-compatibility.yaml, db-compatibility.yaml, coverage.yaml and db-benchmarking.yaml use the action. The docker-e2e if: condition is kept.
  • db-compatibility.yaml and db-benchmarking.yaml also list .github/actions/enable-sccache/** in their path filters, so a change to the action runs them.
  • The sccache ADR has an amendment with the fallback, and why SCCACHE_IGNORE_SERVER_IO_ERROR (it does not cover the startup path in sccache v0.20.0) and retries were not used.
  • The issue spec and its manual verification evidence are updated.

Verification

  • Local: linter all and the pre-commit gate pass. The timeout and the fallback were reproduced locally with a real sccache (V1, V2).
  • Hosted red (V3), throwaway draft PR DO NOT MERGE: [#3019] red run, sccache startup timeout on the current workflow #3033 (closed), with a temporary step that forces server_startup_timeout_ms = 1: Unit (nightly) failed with Timed out waiting for server startup on the current workflow.
  • Hosted green (V4), throwaway draft PR DO NOT MERGE: [#3019] green run, sccache startup timeout with the fallback #3034 (closed), the same temporary step on top of this branch: both Unit jobs passed and showed the sccache disabled warning.
  • The temporary commits are not part of this PR. The josecelano-bot fork starts no workflow runs, so the maintainer chose the draft PRs instead of fork branches.
  • Normal run (V5): this PR's checks, with the sccache stats of the jobs.
  • Not covered by this PR's checks (V6, after the merge): coverage.yaml runs on the merge push to develop, and docker-e2e runs its sccache steps only for a Dependabot branch push.

Closes #3019

🤖 Generated with Claude Code

Summary by CodeRabbit

  • CI Improvements
    • Standardized build caching across CI workflows. Builds now continue without the cache if the cache service fails to start, with a warning instead of a failed job.
    • Updated workflow triggers so changes to the shared caching setup are covered by relevant checks.
  • Documentation
    • Documented the fallback behavior and recorded verification results; some post-merge checks remain pending.

josecelano-bot and others added 5 commits November 24, 2026 17:06
Add the local composite action .github/actions/enable-sccache and use it in
the nine Enable sccache steps. It starts the sccache server with the GitHub
Actions cache backend and no idle timeout, and sets RUSTC_WRAPPER only when
the server started. Otherwise the job builds without the cache and shows a
warning annotation instead of failing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e sccache startup fallback

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the sccache startup fallback

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@josecelano-bot
josecelano-bot requested a review from a team as a code owner November 24, 2026 17:45
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

A shared composite action now checks sccache server startup before enabling the compiler wrapper. CI workflows use the action, and the issue and evidence documents record implementation progress and hosted verification.

Changes: sccache CI startup fallback

Layer / File(s) Summary
Shared action startup and fallback
.github/actions/enable-sccache/action.yml, docs/adrs/20260612000000_adopt_sccache_for_ci_bare_builds.md
The action disables Cargo incremental compilation and attempts to start sccache. On success, it enables the wrapper and GitHub Actions cache backend. On failure, it attempts to stop the server, warns, and leaves the job to build without sccache. The ADR documents this behavior.
CI workflow adoption
.github/workflows/coverage.yaml, .github/workflows/db-benchmarking.yaml, .github/workflows/db-compatibility.yaml, .github/workflows/os-compatibility.yaml, .github/workflows/testing.yaml
These workflows replace inline sccache environment setup with the shared action. The database workflows also add the action path to their push and pull-request filters.
Issue plan and verification records
docs/issues/open/3019-ci-sccache-startup-fallback/*
The issue records implementation progress and remaining post-merge checks. The evidence document records hosted forced-timeout and normal-run results.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Job as GitHub Actions job
  participant Action as enable-sccache action
  participant Server as sccache server
  participant Cache as GitHub Actions cache
  Job->>Action: Invoke action
  Action->>Action: Set CARGO_INCREMENTAL=0
  Action->>Server: Start server with cache backend
  Server->>Cache: Initialize cache backend
  alt Server starts
    Server-->>Action: Startup succeeds
    Action->>Job: Set RUSTC_WRAPPER and SCCACHE_GHA_ENABLED
  else Server startup fails
    Server-->>Action: Startup timeout
    Action->>Server: Stop server if possible
    Action->>Job: Warn and continue without sccache
  end
Loading

Possibly related PRs

Suggested reviewers: josecelano

Merge Risk: Minimal · up to 6ef70

This change lets CI builds continue without sccache if its server fails to start. It affects only CI workflows, and a failure would show up as a CI run failure or warning. No merge-blocking risk remains. The coverage and docker-e2e jobs will be verified after merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: bare CI builds now continue without sccache when its server fails to start. It also cites issue #3019, which the linked objectives describe. The changeset adds the com…
Linked Issues check Passed Directly linked issue #3019 asks that a failed sccache server start should not fail bare CI builds. The new composite action .github/actions/enable-sccache/action.yml (head) meets each stated requir…
Out of Scope Changes check Passed All changed files relate to #3019. The composite action implements the fix. The nine workflow step replacements in testing.yaml, os-compatibility.yaml, db-compatibility.yaml, coverage.yaml and…
Full details: Title check

Explanation

The title names the main change: bare CI builds now continue without sccache when its server fails to start. It also cites issue #3019, which the linked objectives describe. The changeset adds the composite action, updates the workflows that use it, and amends the ADR, so the title matches the primary change.

Full details: Linked Issues check

Explanation

Directly linked issue #3019 asks that a failed sccache server start should not fail bare CI builds. The new composite action .github/actions/enable-sccache/action.yml (head) meets each stated requirement. It runs sccache --start-server with SCCACHE_GHA_ENABLED=true and SCCACHE_IDLE_TIMEOUT=0. On success it exports RUSTC_WRAPPER=sccache, SCCACHE_GHA_ENABLED=true and SCCACHE_IDLE_TIMEOUT=0 to GITHUB_ENV. On failure it runs sccache --stop-server || true, exports no sccache variables, and emits a ::warning annotation. It exports CARGO_INCREMENTAL=0 in both cases and uses shell: bash, so it runs on windows-latest. .github/workflows/testing.yaml (head) uses the action in the unit job and in docker-e2e with the runner.environment == 'github-hosted' condition kept. The other workflows named in the issue use the action as described in the PR summary. The ADR amendment and ISSUE.md updates cover the requested documentation. The forced-timeout red/green check (V3/V4) ran in throwaway draft PRs, not in this PR. The PR text reports those results, and the repository files alone do not prove them. No automated test was required by the issue for this behavior. Remaining gaps are post-merge coverage and docker-e2e runs (V6), which the PR states openly.

Full details: Out of Scope Changes check

Explanation

All changed files relate to #3019. The composite action implements the fix. The nine workflow step replacements in testing.yaml, os-compatibility.yaml, db-compatibility.yaml, coverage.yaml and db-benchmarking.yaml apply the fix to the bare-build jobs. The added .github/actions/enable-sccache/** path filters in db-compatibility.yaml and db-benchmarking.yaml make changes to the action trigger the workflows that use it. The ADR amendment and the ISSUE.md and manual-verification-evidence updates document the change and its verification, as the issue requests. No unrelated code or configuration change was found in the reviewed summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b28aa42f-0f3d-463f-9cc7-78d9c5b22f41
Commits

Reviewing files that changed from the base of the PR and between 64c6394 and 6ef7064.

Files selected for processing: 9

  • .github/actions/enable-sccache/action.yml
  • .github/workflows/coverage.yaml
  • .github/workflows/db-benchmarking.yaml
  • .github/workflows/db-compatibility.yaml
  • .github/workflows/os-compatibility.yaml
  • .github/workflows/testing.yaml
  • docs/adrs/20260612000000_adopt_sccache_for_ci_bare_builds.md
  • docs/issues/open/3019-ci-sccache-startup-fallback/ISSUE.md
  • docs/issues/open/3019-ci-sccache-startup-fallback/manual-verification-evidence.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

This PR adds a shared action that enables sccache only after its server starts. If startup fails, the job warns and builds without the cache.

  • Rust CI builds continue when the sccache server cannot start.

Reviews (2) · Last reviewed commit: "docs(issues): [#3019] record the normal ..." · Reviewed by Greptile

@josecelano

Copy link
Copy Markdown
Member

ACK 2cde16f

@josecelano

Copy link
Copy Markdown
Member

ACK 6ef7064

@da2ce7 da2ce7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed at 6ef706444788cf4bf2dd634586e682f9ada86321. Recomputed from the bytes at this head, against the merge base aea341d40; git merge-tree against develop d89ab84bd is clean: no conflicts, and no path is changed on both sides.

Process: a CI fix with an ADR amendment and spec updates, governed by implement-workflow, create-adr, create-issue and open-pull-request. The adapter stays thin (one if/else), the amendment section has precedent in another root ADR, the index row still holds, and the spec frontmatter fits the issue profile.

The change against its claim: the action starts the server with the cache backend in its step env:, exports the wrapper, backend and idle-timeout variables only on success, warns otherwise, and writes CARGO_INCREMENTAL=0 either way. All nine old steps (2 testing, 1 os-compatibility, 2 db-compatibility, 1 coverage, 3 db-benchmarking) are replaced and none is left; every job checks out before the local uses:; the docker-e2e if: is kept; both path-filtered workflows list the action under push and pull_request, and the rest only ignore Markdown. The V5 hit rates recompute as hits/(hits+misses+errors) in all 17 rows, one per job that ran the action.

Consistency: relative links and related-artifacts paths resolve; no dictionary words are added; nothing moves.

Hygiene: six commits with Conventional subjects carrying [#3019]; author = committer; the one body matches its diff and the other five are subject-only; each commit has one attribution footer, which no rule in the tree forbids. git diff --check is clean, the commit-id check prints nothing, and the only closing keyword is Closes #3019 in the description, for the issue this PR implements.

Findings: F1 to F3, all Nit; none blocks.

Checked, no finding: coverage already had CARGO_INCREMENTAL=0 in its job env; shell: bash covers the windows-latest jobs; the longest action line (151) is under the yamllint limit (200); docker-e2e gets a hosted runner here only on dependency-update branch pushes, as the spec says; V6 and AC2/AC3 are disclosed as post-merge work.

Checks

On the loop's compute node at this head, against the merge base aea341d40 (receipt server-gates-kranich-1421): the repository's pre-commit gate and lint roster exit 0 (509 s wall). This pull request has no review audit record, so there was nothing for the audit validator to check. The PR changes CI workflows, a composite action and documentation, so no package tests apply; the workflows themselves are exercised only by the hosted runs. Checked against the bytes at posting: .github/workflows/os-compatibility.yaml:28-30 sets a matrix of three operating systems by two toolchains, and its enable-sccache step (line 46) therefore runs in six jobs, not the three that ISSUE.md:234 records, as F1 says. The head was confirmed with git ls-remote before posting. GitHub checks at this head at posting time: "Publish (Development): completed/skipped; Publish (Release): completed/skipped; Context: completed/success; Package Coverage (${{ matrix.package }}): completed/skipped; Package Coverage Regression: completed/success; Persistence Benchmark PostgreSQL: completed/success; Persistence Benchmark MySQL: completed/success; Persistence Benchmark SQLite3: completed/success; Test (Docker) (release): completed/success; Docker E2E: completed/skipped; Unit (nightly): completed/success; Layer Boundary Bans: completed/success; Workspace Packaging: completed/success; Unit (stable): completed/success; Source Locations: completed/success; Documented Clippy Allows: completed/success; Shipped Features: completed/success; Database Compatibility MySQL (8.0): completed/success; Database Compatibility MySQL (8.4): completed/success; Database Compatibility PostgreSQL (15): completed/success; Database Compatibility PostgreSQL (14): completed/success; Database Compatibility PostgreSQL (17): completed/success; Database Compatibility PostgreSQL (16): completed/success; Discover Package Coverage: completed/success; Docs Lint: completed/success; Generate Coverage Report: completed/success; Build on windows-latest (stable): completed/success; Build on macos-latest (nightly): completed/success; Build on ubuntu-latest (stable): completed/success; Build on macos-latest (stable): completed/success; Build on ubuntu-latest (nightly): completed/success; Build on windows-latest (nightly): completed/success; CodeRabbit: completed/success; Greptile Review: completed/success". At posting, develop is d89ab84bd.

verification branches and cover `docker-e2e` and `coverage` (V6)
- 2026-11-24 13:07 UTC - Claude Code (Claude Opus 5.5) - Spec PR #3020 merged. Added the
`enable-sccache` composite action, used it in the nine `Enable sccache` steps (the spec said
ten; the `os-compatibility.yaml` matrix makes one step run in three jobs), and amended the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Nit][F1] The os-compatibility.yaml matrix runs the step in six jobs, not three.

os-compatibility.yaml:29-30 is os: [ubuntu-latest, macos-latest, windows-latest] by toolchain: [nightly, stable], and this PR's V5 table lists six Build on ... jobs. The aside means to explain the earlier count of ten, but as written it misstates the matrix. Suggest "runs in six matrix jobs", or dropping the aside.

github-issue: 3019
spec-path: docs/issues/open/3019-ci-sccache-startup-fallback/ISSUE.md
branch: "3019-ci-sccache-startup-fallback-spec"
branch: "3019-ci-sccache-startup-fallback"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Nit][F2] The frontmatter lags the PR: related-pr on the next line is still null.

The progress log (line 244) and V5 record this PR as the spec's implementation run, and other in-progress open specs set the field to their implementation PR (2798-... to 2811, 2902-... to 3009). The linter all criterion (line 258) also stays unchecked, although the description reports linter all passing. Suggest related-pr: 3040, and ticking the criterion if it holds.

- When the server starts, it exports `RUSTC_WRAPPER=sccache`, `SCCACHE_GHA_ENABLED=true` and
`SCCACHE_IDLE_TIMEOUT=0`. With no idle timeout the server lives for the whole job, so no later
compile starts a new server without this check.
- When the server does not start, it stops any server that may still come up late, exports

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Nit][F3] "stops any server that may still come up late" promises more than the step does.

The action calls sccache --stop-server || true once, right after the failed start (.github/actions/enable-sccache/action.yml:33). That call reaches a server only if it is already listening; nothing in the step stops a server that becomes ready afterwards. The effect is benign because RUSTC_WRAPPER is not exported, but the record overstates the guarantee. The spec's Server lifetime bullet (line 132) and the description say the same. Suggest "stops a server that is already listening", or cite the sccache behaviour that covers a later one.

@da2ce7

da2ce7 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

ACK 6ef7064 — the composite action replaces all nine sccache enable steps with a checked server start and a warning fallback, and the workflow, ADR and spec claims recompute at this head apart from three non-blocking Nits

@josecelano
josecelano merged commit 49a3ad0 into torrust:develop Nov 25, 2026
34 checks passed
josecelano added a commit that referenced this pull request Nov 25, 2026
…ssues/closed

4ac24bb docs(pr-reviews): [#3019] record the Greptile review round of PR 3046 (josecelano-bot)
8339a20 docs(issues): [#3019] keep T6b open until the post-merge runs show cache hits (josecelano-bot)
5e2059b chore(issues): archive closed issue #3019 spec to docs/issues/closed (josecelano-bot)

Pull request description:

  Archives the spec for issue #3019 (closed by PR #3040) from `docs/issues/open/` to `docs/issues/closed/`, and records the post-merge evidence.

  - Verified issue #3019 is `CLOSED` on GitHub.
  - Updated frontmatter (`status: done`, `spec-path`, `related-pr: 3040`, `last-updated-utc`) and ticked the completed checkpoints and acceptance criteria.
  - V6 is partial:
    - The `coverage` run of the merge push passed with the GitHub Actions cache backend and no fallback warning. It had 0 hits because the cache service failed every write and many reads during that push; other jobs of the same push were degraded too.
    - No Dependabot branch push has run `docker-e2e` since the merge, so its sccache steps are not yet observed on the new action. It runs the same action as the `unit` job on the same image, verified in V4 and V5.
  - Two checkpoints stay unticked: no reviewer validated the acceptance criteria, and no independent reviewer received the spec.
  - The only remaining references to the old path are command lines recorded in the PR 3020 review audit, kept as history.
  - Pre-commit hooks passed.

  Refs #3019

  🤖 Generated with [Claude Code](https://claude.com/claude-code)

ACKs for top commit:
  josecelano:
    ACK 4ac24bb
  da2ce7:
    ACK 4ac24bb — the archive move, its frontmatter and reference audit, and the review audit record were recomputed at this head, with a clean merge against develop and no blocking finding.

Tree-SHA512: 7614e8a86d36dd46fa7f40912a4306034721f626ebedb8b332eeaf5fe903c17b17d2b0b1f2220b3b3e40fabc5e95b930bc1adb5506eb09aadea931f4088339b6

This branch was previously deployed

1 inactive deployment
coverage — 6ef70644 Deployed Nov 24, 2026 by josecelano-bot via Generate Coverage Report #3477
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.

CI bare builds fail when the sccache server does not start

3 participants