Skip to content

ci: stop rust-cache misses from runner image rollouts - #785

Merged
Karib0u merged 1 commit into
mainfrom
ci/rust-cache-key-fix
Oct 15, 2026
Merged

Karib0u merged 1 commit into
mainfrom
ci/rust-cache-key-fix

Conversation

@Karib0u

@Karib0u Karib0u commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Follow-up to #783, which made PR CI slower (about 19 min on #784, about 10 min before) because its new atomic caches never hit.

Why the caches miss

rust-cache hashes every toolchain installed on the runner into its key. Hosted images are mid-rollout: some runners ship Rust 1.99.0 next to our pinned 1.98.1, so every job flips between two keys depending on the image it lands on. Run 38743554001 shows it: Atomic (macOS) listed both 1.98.1 and 1.99.0 and missed, while Clippy (macOS) in the same run had only 1.98.1 and hit.

Each job now has two ~500 MB copies, plus per-PR copies, so the repo sits at 10.74 GB, over the 10 GB cap, and LRU eviction drops more entries.

Changes

  • add-rust-environment-hash-key: false on every rust-cache step except ebpf-build. rust-toolchain.toml is already in the lockfile part of the key, so a toolchain bump still changes it. ebpf-build keeps the hash because its nightly and bpf-linker pins live in the workflow; dropping it would let a stale cached bpf-linker survive a pin bump.
  • save-if: github.ref == 'refs/heads/main': PRs restore main's caches but no longer write their own copies.
  • Remove the shared atomic-build job from ci: cache macOS atomic build, share one build per OS, shard Windows atomics #783. Each atomic leg builds inline again: the Linux atomics stop waiting on the Windows build, and a warm build is quicker than a job hop plus an artifact transfer. The repo is public, so the extra Windows build costs no minutes. Windows stays split in two shards.
  • Same cache settings in sigma-compatibility.yml and signpath-dry-run.yml.

Expected

The first main run after merge writes caches under the new key format; PRs before that fall back to a prefix match on the old entries. After that, the Windows atomic build should go back to about 110s, and the PR critical path should be eBPF build, then build, then shard: about 6 min.

zizmor --offline is clean on the three workflows.

rust-cache hashed every toolchain preinstalled on the runner. Hosted images
are mid-rollout with Rust 1.99.0 next to the pinned 1.98.1, so each job
flipped between two keys, missed its cache, and doubled the repo's cache
footprint past the 10 GB cap (10.74 GB), which evicted more entries.

- Disable the environment hash on every rust-cache step except ebpf-build;
  rust-toolchain.toml is already part of the lockfile key. ebpf-build keeps
  it because its nightly and bpf-linker pins live in the workflow.
- Save caches from main only. PRs restore main's caches.
- Drop the shared atomic-build job: each atomic leg builds inline again, so
  the Linux atomics no longer wait on the Windows build, and a warm build
  beats a job hop plus an artifact transfer. Windows stays in two shards.
@Karib0u
Karib0u enabled auto-merge (squash) October 15, 2026 14:19
@Karib0u
Karib0u merged commit d555579 into main Oct 15, 2026
35 of 37 checks passed
@Karib0u
Karib0u deleted the ci/rust-cache-key-fix branch October 15, 2026 14:51
Karib0u added a commit that referenced this pull request Oct 15, 2026
#789)

#785 set add-rust-environment-hash-key: false to stop the runner image's
preinstalled toolchains splitting each cache key. That option also drops
the lockfile hash, so every key became static (v0-rust-<job>-<os>-<arch>):
it hits exactly forever, is never re-saved, and a Cargo.lock or
rust-toolchain.toml bump never refreshes it.

Keep rust-cache's default hashing and remove the split at its source: a
step before each cache uninstalls every toolchain except the
rust-toolchain.toml channel, so `rustup toolchain list` shows only the pin.
A lockfile bump again makes a new key that falls back to the old cache.
ebpf-build keeps its own nightly and is left alone.
@Karib0u Karib0u added the ci CI/CD changes label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant