Skip to content

perf: make mainnet ICOS image and canister repos eligible for the repo contents cache - #10903

Merged
basvandijk merged 3 commits into
masterfrom
basvandijk/repo-contents-cache
Jul 27, 2026
Merged

perf: make mainnet ICOS image and canister repos eligible for the repo contents cache#10903
basvandijk merged 3 commits into
masterfrom
basvandijk/repo-contents-cache

Conversation

@basvandijk

@basvandijk basvandijk commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Declare the mainnet_icos_images and canisters rules as reproducible such that they're cached in the remote repo contents cache.

…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>

Copilot AI 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.

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_images and canisters repository rules as reproducible by returning repository_ctx.repo_metadata(reproducible = True).
  • Enable --experimental_repository_cache_hardlinks in the shared .bazelrc build 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.

Comment thread bazel/conf/.bazelrc.build Outdated
@basvandijk
basvandijk marked this pull request as ready for review July 26, 2026 15:15
@basvandijk
basvandijk requested a review from a team as a code owner July 26, 2026 15:15
@github-actions github-actions Bot added the @idx label Jul 26, 2026
Comment thread bazel/conf/.bazelrc.build Outdated
Comment thread bazel/mainnet-icos-images.bzl
@basvandijk
basvandijk enabled auto-merge July 27, 2026 12:40
@basvandijk
basvandijk added this pull request to the merge queue Jul 27, 2026
Merged via the queue into master with commit ae70406 Jul 27, 2026
37 checks passed
@basvandijk
basvandijk deleted the basvandijk/repo-contents-cache branch July 27, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants