perf: make mainnet ICOS image and canister repos eligible for the repo contents cache - #10903
Merged
Conversation
…o contents cache
The custom repository rules in bazel/mainnet-icos-images.bzl and
bazel/mainnet-canisters.bzl never returned repo metadata, so Bazel 9's
repo contents cache ({repository_cache}/contents) refused to store them:
every fresh output base re-downloaded the 2.4-3.2 GB SetupOS/GuestOS
images (~17 GB across the 8 image repos) and the canister WASMs, even on
machines with a fully warm repository cache. This is a major contributor
to the instability of the infer-bazel-targets CI job, whose
rdeps(//..., ...) query forces fetching these repos on every run.
Both rules are reproducible - all downloads are sha256-pinned and the
remaining outputs are derived from the watched revisions JSON and rule
attributes - so declare exactly that by returning
repository_ctx.repo_metadata(reproducible = True).
Verified empirically with a fresh --repository_cache: the first fetch of
@mainnet_latest_hostos_images downloads 2.5 GB in ~59s and populates the
contents cache; a second fetch from a different output base sharing that
cache completes in ~9s with zero network traffic, external/<repo> being
a symlink into the contents cache. Same result for @mainnet_canisters.
Also enable --experimental_repository_cache_hardlinks so repository-cache
hits hardlink instead of copy, saving one on-disk copy per multi-GB blob.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the mainnet ICOS image and canister external repositories eligible for Bazel 9’s repository contents cache, reducing repeated multi-GB downloads across different output bases/workspaces (notably on persisted CI runners), and enables hardlinking on repository-cache hits to reduce disk usage.
Changes:
- Mark
mainnet_icos_imagesandcanistersrepository rules as reproducible by returningrepository_ctx.repo_metadata(reproducible = True). - Enable
--experimental_repository_cache_hardlinksin the shared.bazelrcbuild config to avoid extra copies of large cached blobs when possible.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bazel/mainnet-icos-images.bzl | Declares the ICOS images repository rule reproducible so it can be stored in Bazel’s repo contents cache. |
| bazel/mainnet-canisters.bzl | Declares the mainnet canisters repository rule reproducible so it can be stored in Bazel’s repo contents cache. |
| bazel/conf/.bazelrc.build | Enables repository-cache hardlinking to reduce disk usage on cache hits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
nmattia
approved these changes
Jul 27, 2026
basvandijk
enabled auto-merge
July 27, 2026 12:40
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.
Declare the
mainnet_icos_imagesandcanistersrules as reproducible such that they're cached in the remote repo contents cache.