Repository navigation
Fargate: cap cargo's jobs in a config file, not the environment (rust-cache key) - #37
Merged
Merged
Conversation
With CI_RUNNER_VCPUS set, ci-runner-idle-exit writes /home/runner/.cargo/config.toml with [build] jobs = <n>, leaving an existing file alone. A CARGO_BUILD_JOBS in the environment changes Swatinem/rust-cache's key (it hashes every CARGO*, CC*, CFLAGS*, CXX*, CMAKE* and RUST* variable), so a Fargate job never hit the cache an EC2 job saved. Cargo reads .cargo/config.toml from every ancestor of its working directory, so the file reaches every checkout under _work. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Fargate job never hit the Rust cache an EC2 job saved.
Swatinem/rust-cachehashesCARGO*,CC*,CFLAGS*,CXX*,CMAKE*andRUST*environment variables into its key (source), and Fargate tasks setCARGO_BUILD_JOBS. The cap on cargo's parallelism moves from the environment into a config file.Cargo reads
.cargo/config.tomlfrom every ancestor of the working directory, so the file covers any checkout under/home/runner/_work. rust-cache only hashes config files inside the workspace, so this one leaves the key alone.Evidence
…-ef9743d9-…, against EC2's…-2fd77104-…. The first wave built cold.image/smoke.shcovers five cases (no variable, the file's contents, its ownerrunner, an existing file kept, a bad value). It passed on amd64 and arm64: https://github.com/zeroae/ci-runner/actions/runs/43560324849.Merge Danger
Door: two-way.
Blast Radius: Fargate only.
EC2 doesn't use this entrypoint. Until the launcher change deploys, the old environment variables still apply, and the file is not written (no
CI_RUNNER_VCPUS).Part of #18 (#29).
🤖 Generated with Claude Code