Skip to content

fix: run infer-bazel-targets on namespace - #10896

Draft
basvandijk wants to merge 7 commits into
masterfrom
run-infer-bazel-targets-on-ns
Draft

fix: run infer-bazel-targets on namespace#10896
basvandijk wants to merge 7 commits into
masterfrom
run-infer-bazel-targets-on-ns

Conversation

@basvandijk

@basvandijk basvandijk commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

The infer-bazel-targets, which runs on ubuntu-latest is very unstable (example) and often very slow. This switches the job to run on Namespace (on the same runner profile which is going to be used for running our bazel build and test invocations) which runs the job in under 2 minutes.

These were the resources used when running infer-bazel-targets on the Namespace runner:
Screenshot 2026-07-24 at 11 43 01

We could potentially go one class below to 8x16 but considering the RBE setup is using 16x32 for the driver and 16x32 for the RBE workers to I rather use 16x32 for infer-bazel-targets as well to keep things simple and consistent for now. We can always lower it later if needed.

@github-actions github-actions Bot added the fix label Jul 24, 2026
@basvandijk
basvandijk marked this pull request as ready for review July 24, 2026 10:54
@basvandijk
basvandijk requested a review from a team as a code owner July 24, 2026 10:54
@github-actions github-actions Bot added the @idx label Jul 24, 2026
@basvandijk

basvandijk commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

Maybe the stability issues are not caused by the runner, because this infer-bazel-targets run is running on a namespace-profile-rbe-driver-amd64-linux-16x32 but it appears to hang for 12 minutes already. The following is its resource usage:

Screenshot 2026-07-24 at 13 46 22

@basvandijk
basvandijk marked this pull request as draft July 24, 2026 12:15
basvandijk and others added 5 commits July 24, 2026 18:34
Previously targets.py captured bazel's stderr and only printed it when
the query failed. This swallowed all diagnostics of a *slow* query: in
particular the remote downloader's deadline-exceeded retries and
local-fallback warnings, which made the infer-bazel-targets job look
completely idle while it was grinding through stuck fetches.

Now only stdout (the resulting targets) is captured; stderr streams to
the job log in real time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…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>
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.

1 participant