Skip to content

chore(bazel): upgrade rules_distroless from 0.8.0 to 0.9.4 - #12153

Merged
basvandijk merged 5 commits into
masterfrom
bas/rules-distroless-0.9.4
Nov 18, 2026
Merged

basvandijk merged 5 commits into
masterfrom
bas/rules-distroless-0.9.4

Conversation

@basvandijk

@basvandijk basvandijk commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Upgrades rules_distroless from 0.8.0 to 0.9.4, its latest version on the BCR. GitHub has releases up to v0.11.2 that aren't on the BCR yet. 0.9.4 doesn't fix anything we hit.

0.9.0 replaced the apt extension's API (bazel-contrib/rules_distroless#222). Packages are now declared in MODULE.bazel with apt.sources_list and apt.install(dependency_set, packages) instead of in a YAML manifest. The extension resolves them against the snapshot's package indices, and MODULE.bazel.lock records the result instead of bazel/resolute.lock.json. The resolved package set doesn't change. Neither does anything built from it, except the mode of two files in the system-test runtime image. The IC-OS and publish bundles don't depend on rules_distroless. The released Rosetta images use its passwd rule and are byte-identical.

An evaluation of the extension fetches the snapshot's Packages.xz indices (18 MB) and parses the 84 MB of text in them. That takes 4.8 s with the indices in the repository cache, and took 6.5-8 s when it downloaded them from snapshot.ubuntu.com. Without a lockfile, every new Bazel server that needed @resolute did that again and needed snapshot.ubuntu.com to be up, which was this PR's main cost. Since #12175 committed MODULE.bazel.lock, Bazel reuses the recorded result and evaluates the extension only when its inputs change, and in CI's Bazel Lockfile jobs (see below). Since the last review, this branch merged that master, added the extension's result to MODULE.bazel.lock and updated the comments in MODULE.bazel to match. It also no longer rewords the OVMF comments.

MODULE.bazel.lock

bazel mod deps adds the apt extension to MODULE.bazel.lock, which grows from 0.39 MB (2,947 lines) to 0.96 MB (9,436 lines):

  • Its result. The @resolute hub, whose lock_content holds the resolved package set (one 163 KB line), and two repositories per resolved package (165 deb_import, 165 deb_filemap). Each deb_import entry lists the package's .deb URL, sha256 and depends_on. A snapshot bump rewrites all 165 URLs, since they contain the timestamp; the entries whose name or sha256 changes show which packages changed.
  • Its facts. The sha256 of each channel's Packages.xz, and which variant of each index to fetch (.xz for Packages, "unavailable" for Contents). resolute-security and resolute-updates have the same sha256 because both indices are empty in this snapshot.
  • The registry hashes move from 0.8.0 to 0.9.4. The yq extension's entry changes only in its usages digest, which changes with rules_distroless's version: rules_distroless makes the same yq calls in both versions, and the generated repositories stay the same.

The package list is the manifest's, unchanged. Four of the requested packages (apt, dpkg, perl and libvirt0) are in no image: //rs/tests:PACKAGES doesn't list them, and none of the packages it lists depends on them. 57 of the 165 resolved packages are there only for these four. 41 are there only for libvirt0, which has been unused since #10642. Dropping them is left for a follow-up, so that the resolved set stays the same here.

Bazel reuses the recorded result as long as the extension's usages (the apt tags), the .bzl files it loads (its own and a few of bazel_lib and bazel_tools), its recorded repository mappings and the lockfile format stay the same. So a new Bazel server evaluates no module extension and downloads nothing to load @resolute. Measured in the dev container, three runs each:

On a new Bazel server 0.8.0 (master) 0.9.4
bazel query '@resolute//...' 3.4-3.5 s 3.3 s
bazel query //rs/tests:BUILD.bazel (doesn't load @resolute) 3.3-3.4 s 3.3-3.5 s

None of these profiles evaluates a module extension. With 0.9.4 they show one lockfile check, of apt against MODULE.bazel.lock. 0.8.0's apt is reproducible, so Bazel keeps its result only in the output base's hidden lockfile. With snapshot.ubuntu.com blocked (a downloader config, and no remote downloader), bazel query '@resolute//...' still succeeds. It also does in a new output base, where Bazel has no hidden lockfile to fall back on. In CI run 44369580800 (on cd02db0), the arm64-darwin job prints none of the 24 404 NOT FOUND warnings, 24 Remote Cache: NOT_FOUND warnings and 4 Could not fetch Contents index lines that the evaluation printed in that job before the merge.

Bazel evaluates the extension again when one of those inputs changes, for example on a snapshot bump or a rules_distroless upgrade. CI's two Bazel Lockfile jobs, CI PR Only's update and CI Main's check (which also runs in the merge queue), do it on every pull request that changes an input of MODULE.bazel.lock, even when the apt inputs don't change: they remove the recorded results first, but keep the facts. With the facts, the extension downloads only the four Packages.xz files, by checksum, so the repository cache and the remote downloader can serve them; only when neither has them does it need snapshot.ubuntu.com. It also doesn't try the index variants that don't exist.

I ran what those jobs do in a new output base: remove the results, then bazel mod deps with only bazel/conf/.bazelrc.build (without CI's Namespace cache). The shared repository cache served the four indices. It took 8.0 s and wrote the same bytes, without download warnings or DEBUG lines. The other 62 module extensions were done after 4.2 s; apt took 4.8 s and finished 3.5 s later, so it makes each of those jobs about 3.5 s slower. In CI run 44362279786, bazel mod deps took 24 s and 22 s in the two jobs. After a snapshot bump, the facts don't cover the new indices: that evaluation downloads them without checksums, tries every index variant (24 of them return 404 and print warnings), and records new facts.

What remains:

  • Nothing verifies the indices that the first evaluation of a new snapshot downloads; later evaluations check them against the facts. Signature verification of the Release files arrives in 0.11.0 (bazel-contrib/rules_distroless#255), which isn't on the BCR.
  • MODULE.bazel.lock falls under the *.lock No-Approvals rule in .github/CODEOWNERS, while the deleted bazel/resolute.lock.json was owned by @dfinity/infra through /bazel/. CI re-derives the apt result on every pull request that touches the lockfile. As for go_sdk and pip (see chore(bazel): commit MODULE.bazel.lock and keep it up to date in CI #12175), it uses the recorded facts, the index checksums, as they are.
  • 0.9.4's package repositories aren't reproducible, so Bazel's repo contents cache doesn't keep them. A new output base extracts them again, even with a warm repository cache like the one CI's Bazel Test All keeps. Analyzing //rs/tests:ubuntu_test_runtime_image_src in one creates 199 repository directories (46 MB), where 0.8.0 links 108 from the contents cache (3.8 MB). It took the same time, 6.9-7.2 s against 7.0 s; the .deb downloads come from the repository cache either way.
  • The resolver changes again after 0.9.4 (bazel-contrib/rules_distroless#273 in 0.11.0, bazel-contrib/rules_distroless#281 in 0.11.2). The comment in MODULE.bazel says to review the apt entry of MODULE.bazel.lock when bumping the snapshot or rules_distroless.

Changes

  • MODULE.bazel: version bump. The apt.install(name, lock, manifest) call becomes two apt.sources_list calls and one apt.install(dependency_set = "resolute", ...). The apt.sources_list calls carry the old manifest's four channels: resolute main and universe, resolute-security main and resolute-updates main, all from snapshot 20260422T000000Z, amd64 only. The apt.install call lists the manifest's 22 packages with their comments, unchanged. New comments explain:
    • that the package set is used by the system-test runtime image, that the resolved packages depend on both the snapshot timestamp and the rules_distroless version, and that MODULE.bazel.lock records them, so Bazel evaluates the extension again only when its inputs change;
    • how to update the packages (bump the timestamp in both apt.sources_list calls and run bazel mod deps, which replaces bazel run @resolute//:lock), and what to review in the diff of MODULE.bazel.lock when bumping the snapshot or rules_distroless;
    • that @resolute//<package>/<arch> targets now exist only for the listed packages, under the provider's name when another package Provides: a listed name.
  • MODULE.bazel.lock: regenerated with bazel mod deps, see above.
  • bazel/resolute.yaml, bazel/resolute.lock.json: deleted. 0.9.4 has no manifest input. It reads a lock file (through an apt.lock tag) only on Bazel versions without module_ctx.facts, and it rejects the version 1 format that bazel/resolute.lock.json uses.
  • rs/tests/BUILD.bazel: the comment above PACKAGES pointed at the manifest; it now points at the resolute package set in MODULE.bazel.

Upstream changes that touch our setup

  • New API (bazel-contrib/rules_distroless#222, 0.9.0). The @resolute hub now has //<package>/<arch> targets only for the requested packages, not for all 165 resolved ones. The 18 in //rs/tests:PACKAGES are all requested packages, except coreutils-from-uutils, which is what the requested coreutils resolves to. coreutils and libvirt0 are real packages, but when another package Provides: a requested name, rules_distroless prefers that provider (apt would install the real package). So coreutils resolves to coreutils-from-uutils and libvirt0 to libvirt0-hwe, as with 0.8.0.
  • deb_import (chore(IDX): bump actions/upload-artifact version #222). In 0.8.0 a macro around http_archive, it is now a repository rule of its own, which doesn't mark its repositories reproducible (see above). The BUILD file it generates also declares C++ targets (so_library, cc_deb_library and cc_library, and cc_import for packages with pkg-config files). It always loads @rules_cc//cc/private/rules_impl:cc_import.bzl, @rules_cc//cc:cc_library.bzl and @bazel_skylib//rules/directory:directory.bzl, and its deb_export rule loads @aspect_bazel_lib//lib:tar.bzl. All of them exist in our rules_cc 0.2.28, bazel_skylib 1.9.2 and aspect_bazel_lib 2.22.5. The C++ targets have no headers or libraries for any of the 108 packages we fetch, and nothing here uses them: deb_import only lists the files of a data.tar.xz, and 107 of them ship data.tar.zst (the other one, passwd, has no libraries or headers). The package's data layer is renamed from layer.tar.gz to content.tar.gz, with the same bytes.
  • New module dependencies. The module now also depends on aspect_bazel_lib 2.14.0 and rules_cc 0.2.8. Both are below our versions, so the module graph doesn't change otherwise.
  • Resolver changes. When several different packages provide a name the resolver looks up (a requested package or one of its dependencies) and none of them has Priority: required, 0.9.x picks the provider with the highest version, where 0.8.0 fell back to a real package of that name. It also expands Architecture: all packages per architecture (bazel-contrib/rules_distroless#235) and leaves foreign-architecture dependencies out (bazel-contrib/rules_distroless#241). Our package set resolves the same (see Verification).
  • cacerts file modes (bazel-contrib/rules_distroless#225, 0.9.0). cacerts now writes /etc/ssl/certs/ca-certificates.crt and /usr/share/doc/ca-certificates/copyright with mode 0644 instead of 0555; directories stay 0755. This is the only difference in //rs/tests:ca_certificates. It is therefore also the only difference in the system-test runtime image //rs/tests:ubuntu_test_runtime_image_src and in the httpbin image built from it. //rs/tests:colocate_uvm_config_image contains the runtime image's tarball and also records that file's mtime (see Verification). The bundle stays world-readable.
  • flatten (bazel-contrib/rules_distroless#228, 0.9.1). flatten now takes rm from bazel_lib's coreutils toolchain. //rs/tests:ubuntu_packages_tar is byte-identical.

Verification

All of this ran in the dev container on this branch, which has master at 195b444 merged in. 0.8.0 is that master commit, built in the same output base.

  • MODULE.bazel.lock:
    • bazel mod deps generates it. A second run on a new server leaves it unchanged, and so does bazel build //... --nobuild.
    • What CI's Bazel Lockfile jobs do gives the same bytes in a new output base (see above).
    • In CI runs 44362279786 (on fce258f) and 44369580800 (on cd02db0, which changes only comments in MODULE.bazel), CI PR Only's Bazel Lockfile job found nothing to update, CI Main's check of the merge with master passed, and so did the Check MODULE.bazel.lock steps of Bazel Test arm64-linux and arm64-darwin.
  • bazel mod graph: only rules_distroless changes. All other modules resolve to the same versions, and there are no new warnings.
  • Resolution. The lock content recorded in MODULE.bazel.lock (bazel mod show_repo @resolute) has the same 165 packages, versions, sha256s and URLs as the deleted lock file. Each of the 22 requested packages has the same dependency closure, in the same order.
  • bazel build //... --nobuild: all 3375 targets analyze.
  • Builds, compared with 0.8.0.
    • I built every target that uses a rules_distroless rule (four passwd, cacerts, dpkg_status, flatten), and the 18 @resolute packages we use with their :control targets.
    • I also built the images that contain them: //rs/tests:ubuntu_test_runtime_image_src, //rs/tests:ubuntu_test_runtime.tar, //rs/tests:colocate_uvm_config_image, //rs/tests/httpbin-rs:httpbin.tar, //rs/rosetta-api/icp:rosetta_image.tar and //rs/rosetta-api/icrc1:icrc_rosetta_image.tar.
    • 44 of these 49 targets are byte-identical with 0.8.0. They include //rs/tests:ubuntu_packages_tar (163 MB), :dpkg_status, the four passwd layers and both Rosetta images.
    • The other 5 are //rs/tests:ca_certificates and the images and tarballs that contain it. 7 of the 142 distinct files these targets output differ:
      • ca_certificates differs only in the file modes above; the file contents are the same.
      • In the image tarballs, only that layer and the config and manifest that reference it differ.
      • The FAT image //rs/tests:colocate_uvm_config_image holds the runtime tarball and also records that file's time, because mcopy -m keeps the tarball's mtime, which is when Bazel wrote it.
    • Matched package by package, the 108 per-package data layers among these outputs are byte-identical too.
  • Release artifacts: not rebuilt. The unconfigured bazel query 'deps(...)' of the IC-OS bundles, //publish/binaries:bundle and //publish/canisters:bundle has 57,438 labels. It contains no rules_distroless or @resolute label, and none of the targets above. The Rosetta images, which rosetta-release.yml pushes, are among the byte-identical builds above.
  • CI's lint checks pass: shfmt-check, ruff-check, buf-check, DFINITY-capitalization-check, do-not-merge-check, buildifier-check, gazelle-check and buf-breaking-check. The autofixes (buildifier, shfmt, ruff and gazelle) change nothing. These and bazel build //... --nobuild ran on the final MODULE.bazel. CI's Autofix job, which also runs rustfmt, passed on cd02db0.
  • System tests: none run locally.
    • All 452 tests that depend on these targets are system tests under //rs/tests/...: 413 Farm variants and 39 _local variants.
    • This PR's CI selects 2 of them, //rs/tests/networking:canister_http_non_replicated_test_local and //rs/tests/node:root_tests_local. Both reach //rs/tests:ca_certificates through the runtime image, and both passed in CI run 44369580800 (on cd02db0).
    • CI Main on master also runs 32 more _local dependents, which are tagged long_test; so does a PR with the CI_ALL_BAZEL_TARGETS label. The other 5 _local dependents have tags that CI Main excludes.
    • Of the Farm variants, CI Main runs none. release-testing.yml and the nightly workflows run those of system_test_large tests and of nightly- or benchmark-tagged tests. They also run two manual ones by name: //rs/tests/dre:guest_os_qualification_farm_colocate and //rs/tests/nested/nns_recovery:nr_large_with_mainnet_state_farm_colocate.

🤖 Generated with Claude Code

rules_distroless 0.9.0 replaced the `apt` extension's API: packages are
declared in MODULE.bazel instead of a YAML manifest, and on Bazel 9 the
extension resolves them against the snapshot's package indices whenever
it is evaluated instead of reading a checked-in lock file. Move the
package set from //bazel:resolute.yaml into `apt.sources_list` and
`apt.install` calls in MODULE.bazel, and delete the manifest and the
lock file, which 0.9.x doesn't read on Bazel 9 (and whose version 1
format it no longer accepts).

The resolved package set is unchanged (same 165 packages, versions,
sha256s and URLs), and the built package layers are byte-identical.
`cacerts` now writes its files with mode 0644 instead of 0555.

Since we run with --lockfile_mode=off, the extension can't cache the
indices' checksums (it keeps them as MODULE.bazel.lock facts), so every
new Bazel server that evaluates it downloads (~40 MB) and parses the
indices again: ~30-35 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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.

🔵 Needs a closer look

Maintainer judgment is needed because, with lockfiles disabled, the upgrade replaces reviewed package hashes with hashes from unpinned indices and adds a snapshot.ubuntu.com availability dependency plus 30–35 seconds to fresh-server analysis.

No open issues 🎉

What changed in this PR

Upgrades rules_distroless from 0.8.0 to 0.9.4 and migrates the Ubuntu package configuration used by system-test runtime images to the new API.

Changes:

  • Moves the same 22 requested packages and four snapshot channels into MODULE.bazel.
  • Removes the legacy YAML manifest and package lock file, and updates related comments.
  • Documents repeated index downloads with lockfiles disabled. Reported verification preserves package resolution; image differences are limited to two certificate-related file modes.
File Description
rs/​tests/​BUILD.bazel Updates a comment to point to the package set in MODULE.bazel.
MODULE.bazel Bumps the dependency, migrates the apt configuration, and documents evaluation behavior.
bazel/​resolute.yaml Deletes the manifest now represented in MODULE.bazel.
bazel/​resolute.lock.json Deletes the legacy lock file unused by the new extension on Bazel 9.

Review effort: Balanced

The packages the `apt` extension resolves depend on the rules_distroless
version (its resolver) as well as on the snapshot timestamp, and no
checked-in file records them, so say what to compare when bumping
either. `coreutils` and `libvirt0` are real packages, not virtual ones:
rules_distroless prefers the packages that provide those names.

The previous commit message gives the extension's cost on a new Bazel
server as ~30-35 s. That came from two earlier runs; in later runs the
evaluation took 6.5-7.8 s (15.6 s at most), adding 6-7 s to
`bazel query '@resolute//...'`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

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.

🔵 Needs a closer look

Build-infrastructure owners need to explicitly accept replacing reviewed package hashes with live unsigned-index resolution while lockfiles are disabled, introducing supply-chain risk, a snapshot.ubuntu.com availability dependency, and fresh-server latency.

No open issues 🎉

Review effort: Balanced

@basvandijk
basvandijk marked this pull request as ready for review November 18, 2026 08:11
@basvandijk
basvandijk requested a review from a team as a code owner November 18, 2026 08:11
basvandijk and others added 2 commits November 18, 2026 17:36
Brings in the committed MODULE.bazel.lock (#12175), which records the
apt extension's facts and generated repositories, and the other bazel_dep
upgrades of this batch. No conflicts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Generated with `bazel mod deps` in the dev container. It now records the
apt extension's result (the resolved package set as the `@resolute` hub's
lock content, and the 165 packages' .deb URLs and sha256s) and its facts
(the checksums of the snapshot's package indices), so Bazel evaluates the
extension again only when its inputs change. The registry hashes move from
rules_distroless 0.8.0 to 0.9.4. Of the yq extension's entry only the
usages digest changes: rules_distroless uses that extension with the same
calls in both versions, and its generated repositories stay the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 17:45

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.

🟡 Changes recommended

The MODULE.bazel guidance contradicts the committed lockfile’s reuse behavior and needs to document the required lockfile regeneration and review process.

1 open issue

Review effort: Balanced

Comment thread MODULE.bazel Resolved
…ents

The comment above the `apt.sources_list` calls still described running
with `--lockfile_mode=off`. It now says that MODULE.bazel.lock records the
extension's result, so Bazel evaluates it again only when one of its
inputs changes, that `bazel mod deps` updates it, and what to review in
its diff when bumping the snapshot or rules_distroless.

The two OVMF comments get master's wording back: now that MODULE.bazel.lock
records the package set, avoiding bloat in the lockfile is again the
reason to download those .debs directly.

With this change `bazel mod deps` leaves MODULE.bazel.lock unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 18:25

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.

🟢 Approval recommended

No active review issues are reported for the rules_distroless upgrade and package-configuration migration.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

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.

🟢 Approval recommended

No active review issues block the rules_distroless upgrade and apt configuration migration.

No open issues 🎉

Review effort: Balanced

@basvandijk
basvandijk enabled auto-merge November 18, 2026 18:40
@basvandijk
basvandijk added this pull request to the merge queue Nov 18, 2026
@basvandijk
basvandijk requested a balanced review from Copilot November 18, 2026 18:57

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.

🔵 Needs a closer look

Infra confirmation is needed because integrity hashes move from infra-owned /bazel/ to approval-exempt *.lock files, while CI trusts recorded index checksums and the resolver lacks Release-signature verification.

No open issues 🎉

Review effort: Balanced

Merged via the queue into master with commit 5946898 Nov 18, 2026
54 checks passed
@basvandijk
basvandijk deleted the bas/rules-distroless-0.9.4 branch November 18, 2026 19:26
AleDema pushed a commit to AleDema/ic that referenced this pull request Nov 18, 2026
…finity#12175)

Commits `MODULE.bazel.lock` again (it was removed in dfinity#1990) and adds CI
that keeps it current.

## Why

With `--lockfile_mode=off`, every new Bazel server:
- re-evaluates every module extension;
- fetches registry files without checksums;
- fetches `metadata.json` for every module, so an upstream yank can
break the build;
- refetches what the extensions look up on the network: the PyPI index
for pip (dfinity#12041), go.dev for go_sdk, and for
rules_distroless 0.9.x about 84 MB of apt indices (this blocks dfinity#12153).

## What changes

- **The lockfile.** `MODULE.bazel.lock` (Bazel 9.3.2, lockFileVersion
28, 0.39 MB) is committed, and `common --lockfile_mode=off` is
  gone, so Bazel's default `update` mode applies everywhere.
- **New reusable workflow `.github/workflows/bazel-lockfile.yml`.** It
runs on Namespace (`namespace-profile-rbe-driver-amd64-linux-16x32`,
  or its `-no-cache` copy for reviewed fork code) and has two modes:
- **update**, called from CI PR Only: when a PR changes an input of the
lockfile, regenerate it with `bazel mod deps`. If it changed,
a separate push job commits "Automatically updated MODULE.bazel.lock"
onto the head branch. Fork PRs get the diff and an artifact
instead. The push job is the only job that holds the bot's key, and it
runs no Bazel.
- **check**, called from CI Main: fail when the lockfile isn't what
Bazel generates. This keeps an outdated lockfile out of the merge
    queue, where `ci-pr-only-status` is always green.
- On PRs and merge groups that touch an input, it re-derives the module
extension results, which catches bad merges.
    - On pushes it does a plain update.
- **Generated on amd64-linux only.** Every module extension records a
platform-independent (`general`) result today. A new last step of
Bazel Test arm64-{linux,darwin} fails when Bazel rewrites the file on
those platforms. On pushes that step only reports, so it can't
  block artifact uploads.
- **Small adjustments.**
- `bazel/workspace_status.sh` ignores `MODULE.bazel.lock` in its dirty
check, so a stale lockfile on a release branch can't produce
    `-dirty` artifacts.
- Autofix doesn't stage the file, and Lock Generate tolerates a
malformed one.
- The cargo jobs no longer trigger on it, and `targets.py` treats it
like `MODULE.bazel`.
  - The buildifier pre-commit regex no longer matches it.
- **Docs.** A new "MODULE.bazel.lock" section in `bazel/README.md`, and
the check-bazel-files skill.

## For developers

- After changing `MODULE.bazel`, `bazel/*.MODULE.bazel`, a module
override patch, `.bazelversion` or `requirements.txt`, run
`bazel mod deps >/dev/null` and commit the lockfile. On a PR from a
branch in this repository the bot also does it.
- Before pulling this change, delete any untracked `MODULE.bazel.lock`
left over from earlier experiments.
- Parallel `bazel_dep` bumps will often conflict in the lockfile. The
recipe is in `bazel/README.md`.

## Notes for review

- **CODEOWNERS is unchanged.** `MODULE.bazel.lock` falls under the
`*.lock` No-Approvals rule. What CI does with each part of the file:
- it re-derives the module extension results on every PR that touches an
input;
  - registry hashes are checked against what Bazel downloads;
  - facts (go_sdk, pip, msvc_runtime) are used as recorded.

Requiring infra approval would take a `/MODULE.bazel.lock
@dfinity/infra` line after the No-Approvals block.
- **Exercised in CI so far:**
- This PR: the update job found nothing to push, CI Main's check passed,
and the new step of Bazel Test arm64-linux and
arm64-darwin passed. The darwin leg builds all of `//rs/...` and
`//packages/...`.
- Throwaway dfinity#12176 hand-edited a recorded extension result. The update
job re-derived it, the push job committed the repaired file
    byte for byte, and the run for the bot's commit was green.
- Pushes to `dev-gh-bazel-lockfile`: the plain check passed for this
commit. For a commit with one registry hash deleted, it failed
with the expected annotation and uploaded the repaired file as
`bazel-lockfile-check`.
- **Not exercised yet:** the fork path through CI Kickoff Manual, to be
tried after merge.

## Verified locally

These all produced identical bytes in the dev container:
- two from-scratch generations;
- a generation with CI's rc set;
- the check job's strip and regeneration;
- a plain update.

`bazel build //... --nobuild` leaves the file unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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