Skip to content

chore(bazel): upgrade rules_pkg from 1.0.1 to 1.3.0 - #12147

Merged
basvandijk merged 1 commit into
masterfrom
bas/rules-pkg-1.3.0
Nov 18, 2026
Merged

basvandijk merged 1 commit into
masterfrom
bas/rules-pkg-1.3.0

Conversation

@basvandijk

Copy link
Copy Markdown
Collaborator

Upgrades rules_pkg from 1.0.1 to 1.3.0, its latest release. The GitHub tag is 1.3, while the BCR module and the release tarball are 1.3.0.

Changes

  • MODULE.bazel: version bump, the only edit. BCR's rules_pkg/1.3.0 has no patches or overlay.
    • rules_pkg is a dependency of the root module and of protobuf 33.0. protobuf asks for 1.0.1 and now gets 1.3.0 too. It uses pkg_files, pkg_filegroup, pkg_attributes, strip_prefix, pkg_tar, pkg_zip and three providers for its own release packaging, and they all still exist in 1.3.0.
    • 1.3.0 now requires rules_python 1.7.0, bazel_skylib 1.9.0 and rules_license 1.0.0. We already resolve 2.4.6, 1.9.0 and 1.0.0, so no other module's resolved version changes.

Nothing else needed to change. We use pkg_tar (with srcs, files, deps, package_dir, strip_prefix, mode and extension = "tar"/"tar.gz") and pkg_mkdirs with pkg_attributes. build_tar is still a py_binary, so the comment in bazel/conf/.bazelrc.build that names it is still accurate.

Upstream changes that touch our setup

All of these are in pkg_tar. We use it for the tarballs that become the SetupOS config and data partitions, for sns_testing_bundle.tar.gz in //publish/binaries:bundle, and for layers of the Rosetta and httpbin OCI images.

  • Duplicate detection (bazelbuild/rules_pkg#949, 1.2.0): build_tar now ignores trailing / when it compares paths. So a directory and a file or symlink at the same path no longer both end up in the archive (the first one added wins). None of our archives has such a collision, and their contents are unchanged (see Verification).
  • gzip level (bazelbuild/rules_pkg#888, 1.1.0): the new compression_level attribute defaults to -1, which means level 6, the level 1.0.1 hard-coded. sns_testing_bundle.tar.gz is our only compressed pkg_tar, and it is byte-identical.
  • Stamping (bazelbuild/rules_pkg#1035, 1.3.0): with the default stamp = 0, pkg_tar no longer selects on --stamp. None of our targets sets stamp, so pkg_tar still never stamps, with or without --stamp (which rosetta-release.yml passes).
  • Manifest: the JSON manifest that pkg_tar passes to build_tar has a new repository field (bazelbuild/rules_pkg#1016), which build_tar ignores. This field and the changed build_tar sources give every PackageTar action a new cache key, so they all re-run once. Their outputs don't change.
  • Not used here:
    • preserve_mode and preserve_mtime are opt-in (#951, #974).
    • The repo-mapping manifest and runfiles symlinks only apply with include_runfiles = True (#878, #1025).
    • Files from ctx.actions.declare_symlink() are now archived as symlinks (#930), but none of our inputs are such files.

Verification

All in the dev container:

  • bazel mod graph: compared with master, only the two rules_pkg lines change (the root's and protobuf's dependency). There are no new warnings. The existing rules_qemu use_repo warning is unchanged.
  • bazel build //... --nobuild: all 3387 targets analyze.
  • Linter job: //pre-commit:{shfmt-check,ruff-check,buf-check,DFINITY-capitalization-check,do-not-merge-check,buildifier-check,gazelle-check,buf-breaking-check} pass. buildifier-fix, shfmt-fix, ruff-fix and //:gazelle leave the tree clean.
  • Release artifacts are byte-identical. I built //publish/binaries:bundle, //publish/canisters:bundle and the unstamped IC-OS bundles that ci/container/build-ic.sh --icos builds (GuestOS prod disk and update, GuestOS recovery update, HostOS prod update, SetupOS prod). All 133 output files, including the SetupOS disk image and sns_testing_bundle.tar.gz, have the same SHA-256 as a build of master at c712eb2.
  • All other pkg_tar outputs are byte-identical. I built these 16 targets with 1.0.1 and with 1.3.0 in the same output base, and both builds produce the same 67 files:
    • //rs/rosetta-api/icp:{data_tar,rosetta_image_homedir,rosetta_image} and //rs/rosetta-api/icrc1:{data_tar,ic_icrc_rosetta_image_homedir,ic_icrc_rosetta_image} (the images that rosetta-release.yml pushes)
    • //rs/sns/testing:{sns_testing_bin,sns_testing_dependencies,sns_testing_env,sns_testing_bundle}
    • //rs/tests/httpbin-rs:{httpbin_image_homedir,httpbin_image_src}
    • the config_tar of all four SetupOS variants (dev, local-base-dev, local-base-prod, prod)
  • //ic-os/setupos/envs/prod:disk_img_size_check passes.
  • Not run locally: the system tests that use these images (//rs/tests/...: Rosetta, canister HTTP, nested/SetupOS). I also didn't build the data_tar of the dev and local-base SetupOS variants. CI covers the full build and tests.

🤖 Generated with Claude Code

Bump the rules_pkg bazel_dep to its latest release. No other module's
resolved version changes, and our pkg_tar and pkg_mkdirs usages work
unchanged. The released IC-OS images, //publish/binaries:bundle and
//publish/canisters:bundle are byte-identical to master's. So are all
other pkg_tar outputs (the Rosetta and httpbin image layers, the
sns_testing tarballs and the SetupOS config tarballs) when built with
1.0.1 and with 1.3.0.

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.

🟢 Approval recommended

No active review issues were identified for the rules_pkg version update.

No open issues 🎉

What changed in this PR

Upgrades rules_pkg from 1.0.1 to 1.3.0, updating the Bazel packaging dependency used for release tarballs and image layers.

Changes:

  • Updates only the dependency version; existing packaging targets and configuration remain unchanged.
  • The PR reports unchanged resolved versions for other dependencies and byte-identical artifacts in the builds compared.
File Description
MODULE.bazel Bumps rules_pkg from 1.0.1 to 1.3.0.

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
basvandijk added this pull request to the merge queue Nov 18, 2026
Merged via the queue into master with commit 936d6e3 Nov 18, 2026
43 checks passed
@basvandijk
basvandijk deleted the bas/rules-pkg-1.3.0 branch November 18, 2026 10:41
basvandijk added a commit that referenced this pull request Nov 18, 2026
#12155's branch now has master merged in. master has #12147 (rules_pkg 1.0.1
-> 1.3.0), which changed the line right above this PR's rules_oci line. The
resolution keeps both: rules_pkg 1.3.0 from master and rules_oci 2.3.5 from
this PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AleDema pushed a commit to AleDema/ic that referenced this pull request Nov 18, 2026
Upgrades `rules_oci` from 2.0.0 to
[2.3.5](https://github.com/bazel-contrib/rules_oci/releases/tag/v2.3.5),
its latest release.

This PR was stacked on dfinity#12155, which has landed and upgraded
`aspect_bazel_lib` from 2.19.3 to 2.22.5 with a version pin and a patch.
This PR now targets master, with master merged in: `rules_oci` 2.3.5
declares `bazel_dep(name = "aspect_bazel_lib", version = "2.21.1")`.
This PR itself only changes the `rules_oci` line in `MODULE.bazel`.
dfinity#12155 describes what the `aspect_bazel_lib` upgrade and its patch
change, including which toolchains our `oci_*` targets resolve to.

No BUILD or `.bzl` file needs to change. Everything built with
`rules_oci` comes out byte-identical, and so do the release artifacts.

## Changes

- **`MODULE.bazel`**: `rules_oci` 2.0.0 → 2.3.5. BCR's `rules_oci/2.3.5`
only carries the usual `module_dot_bazel_version.patch`.

The new dependencies of `rules_oci` 2.3.5 (`tar.bzl` ≥ 0.7.0,
`package_metadata` ≥ 0.0.6) already resolve to `tar.bzl` 0.10.4 and
`package_metadata` 0.0.7 through other modules (`rules_distroless`,
`llvm`, `rules_python`, ...), and stay there. Compared with dfinity#12155, only
`rules_oci` changes version in the resolved module graph, and `bazel mod
graph` prints no root-module version warnings.

## Upstream changes that touch our setup

**`oci.pull`** (the 15 images in `MODULE.bazel`)
- The generated repos keep their names (`<name>`, `<name>_linux_amd64`),
so the `use_repo` lines stay as they are. Their BUILD files now load
`copy_to_directory` through `rules_oci`
([bazel-contrib/rules_oci#891](bazel-contrib/rules_oci#891))
and give their targets the image's purl as `package_metadata`
([bazel-contrib/rules_oci#883](bazel-contrib/rules_oci#883)).
- The repos of pulls pinned by a `sha256` digest, which all of ours are,
are now declared reproducible. They no longer watch the Docker/Podman
credential files or the environment variables that locate them
([bazel-contrib/rules_oci#901](bazel-contrib/rules_oci#901)).
The `oci` extension itself is only declared reproducible when every
`oci.pull` sets the `digest` attribute
([bazel-contrib/rules_oci#882](bazel-contrib/rules_oci#882)).
Ours put the digest in `image`, so the extension stays non-reproducible.
That makes no difference with our `--lockfile_mode=off`. Nothing to
change on our side: every blob is still checked against its digest.

**`oci_image`** (the two rosetta images,
`//rs/tests:ubuntu_test_runtime_image_src` and the httpbin images)
- regctl goes from v0.7.0 to v0.8.0
([bazel-contrib/rules_oci#744](bazel-contrib/rules_oci#744));
crane stays at v0.18.0. `image.sh` now drops an embedded `config.data`
from the manifest
([bazel-contrib/rules_oci#774](bazel-contrib/rules_oci#774)).
Our image layouts come out byte-identical, so none of our images had
one.
- The macro's helper targets lose their leading underscore and are
tagged `manual`
([bazel-contrib/rules_oci#759](bazel-contrib/rules_oci#759),
[bazel-contrib/rules_oci#898](bazel-contrib/rules_oci#898)).
Nothing in the repo refers to them, and `<name>.digest` is unchanged.
- `oci_image` and `oci_load` request `aspect_bazel_lib`'s coreutils
toolchain type, which is an alias of `bazel_lib`'s with dfinity#12155. So with
this stack they run `bazel_lib`'s uutils coreutils 0.5.0, where master
runs `aspect_bazel_lib` 2.19.3's 0.0.27. jq and zstd are still
`aspect_bazel_lib`'s.

**`oci_load`** (our `oci_tar` macro in `rs/tests/system_tests.bzl`)
- The tarball action now asks for `tar.bzl`'s toolchain type
([bazel-contrib/rules_oci#844](bazel-contrib/rules_oci#844)).
That resolves to `tar.bzl`'s bsdtar 3.8.1 (hermeticbuild/bsdtar-prebuilt
v3.8.1-3), which our `tar` and `rules_distroless` targets already use.
2.0.0 used `aspect_bazel_lib` 2.19.3's bsdtar 3.7.9. The tarballs are
byte-identical. The `tarball` output group and the `<name>/tarball.tar`
path are unchanged, so the paths in
`rs/rosetta-api/local/cluster/README.md` still hold.
- The `bazel run` loader now pipes `tar` into `docker|podman load` and
fails when `tar` fails
([bazel-contrib/rules_oci#881](bazel-contrib/rules_oci#881)).
Nothing here uses it; the tests `docker load` the tarball files.

**`oci_push`** (`//rs/rosetta-api/icp:push_rosetta_image` and
`//rs/rosetta-api/icrc1:push_ic_icrc_rosetta_image`, run by the Rosetta
Release workflow)
- crane and jq are now built for the exec platform instead of being
transitioned to the target platform
([bazel-contrib/rules_oci#869](bazel-contrib/rules_oci#869)).
The push script now finds crane, jq, the image and the tags file through
runfiles
([bazel-contrib/rules_oci#804](bazel-contrib/rules_oci#804)).
Our fixed `repository` plus the `:stamped` tags file work as before
(tested below). crane still reads the `~/.docker/config.json` that the
workflow writes, so the workflow's comment about it stays accurate.
- Under `--stamp`, which the workflow passes, the `:stamped` tags files
are now written by `bazel_lib`'s `expand_template` binary (alias plus
patch, from dfinity#12155). They come out identical.

**Bazel 7 or later** is required from 2.3.5 on
([bazel-contrib/rules_oci#913](bazel-contrib/rules_oci#913));
we use 9.3.2.

## Verification

All of this ran in the dev container on this branch, which includes
dfinity#12155's changes, unless noted otherwise. dfinity#12155 has the checks of the
`aspect_bazel_lib` patch itself (what resolves without it, and the
`bazel_lib` 3.8.0 failure it prevents).

- `bazel mod graph` and `bazel mod explain`: compared with master, only
`aspect_bazel_lib` (2.19.3 → 2.22.5) and `rules_oci` (2.0.0 → 2.3.5)
change. There are no root-module version warnings.
- `bazel build //... --nobuild`: all 3367 targets analyze. All 24
`oci_*` targets build, including the manual ones such as both `oci_push`
targets.
- Toolchain resolution (`bazel aquery`/`cquery`):
- Release artifacts: the 22 `CopyFile` and 86 `CopyToDirectory` actions
in their build graph run `bazel_lib`'s coreutils and
`copy_to_directory`, as on master. No `aspect_bazel_lib` target is in
that graph.
-
`//rs/tests:{sh,awk,ca_certificates,dpkg_status,passwd,ubuntu_packages_tar}`
and the `passwd` targets of httpbin and both rosetta packages run
`tar.bzl`'s bsdtar, as on master.
- `oci_load`'s tarball actions use `tar.bzl`'s bsdtar 3.8.1. The
`oci_image` and `oci_load` actions get `bazel_lib`'s coreutils 0.5.0 and
`aspect_bazel_lib`'s jq. `oci_image`'s actions also get
`aspect_bazel_lib`'s zstd and `rules_oci`'s regctl v0.8.0. Pulled images
are laid out with `bazel_lib`'s `copy_to_directory`. `expand_template`
under `--stamp` runs `bazel_lib`'s binary.
- Built and hashed on master and with this PR, in the same output base:
- 14 pulled images (all but `@ubuntu_base`, see below), the 7
`oci_image` layouts, the `.digest` files of the rosetta and
`ubuntu_test_runtime_image_src` images, the 15 `oci_tar` tarballs
(`oci_load`'s `tarball` output group) and the 9 `uvm_config_image`s that
pack those tarballs for the system tests. All 272 files are
byte-identical.
- The outputs of the `tar`, `rules_distroless` and `:stamped` targets
listed above (11 files), and the two `:stamped` tags files built with
`--stamp --embed_label=1.2.3`. These are byte-identical too.
- `oci_push`, end to end: a temporary, uncommitted package declared
`oci_push` targets for both rosetta images. They were set up like ours
(`remote_tags = ":stamped"` from `expand_template`), but with a `crane
registry serve` on 127.0.0.1 as `repository`. `bazel run` pushed both
images, one of them with `--stamp --embed_label=9.9.9` and an extra
`--tag` given at run time. The digests in the registry equal the
`.digest` outputs, and the tags `0.0.0`, `9.9.9` and `extra-tag` were
applied.
- `oci_load`: `bazel run //rs/tests:static-file-server_tarball` loads
the image into podman, and `podman load` of the built
`//rs/tests:static-file-server.tar` gives the same image ID.
- `bazel query --lockfile_mode=update` records the `oci` extension in
`MODULE.bazel.lock`, so the extension is not declared reproducible (see
`oci.pull` above).
- The Linter job's checks pass: shfmt, ruff, buf,
DFINITY-capitalization, do-not-merge, buildifier, gazelle and
buf-breaking. The buildifier, shfmt and ruff fixes, gazelle and
`//:buildifier` change nothing.
- **Release artifacts are byte-identical.** I built the unstamped IC-OS
bundles that `ci/container/build-ic.sh --icos` builds (GuestOS prod disk
and update, GuestOS recovery update, HostOS prod update, SetupOS prod),
plus `//publish/binaries:bundle` and `//publish/canisters:bundle`. All
133 output files have the same SHA-256 as a build of master at
c712eb2. No sandboxed action ran: of 12,953 processes, all but the 26
that run unsandboxed (`local`) were cache hits.

- **After merging dfinity#12155's updated branch** (which now has master merged
in): master's dfinity#12147 (`rules_pkg` 1.3.0) changed the line right above
this PR's `rules_oci` line, and the merge keeps both. Compared with
dfinity#12155's branch, `bazel mod graph` changes only `rules_oci`. `bazel mod
explain aspect_bazel_lib --verbose` shows `rules_oci` 2.3.5 asking for
2.21.1, which the pin resolves to 2.22.5. `bazel build //... --nobuild`
analyzes all 3369 targets: 20 fewer than dfinity#12155's 3389, as before,
because the oci macros' helper targets are now tagged `manual`. `bazel
run //:buildifier` changes nothing. A simulated squash of dfinity#12155
followed by a merge of this branch is clean, and the net change is the
`rules_oci` line.

- **After dfinity#12155 landed**, I merged master into this branch (no
conflicts). The diff against master is the `rules_oci` line. `bazel
build //... --nobuild` analyzes all 3375 targets, `bazel run
//:buildifier` changes nothing, and `bazel mod explain aspect_bazel_lib
--verbose` still shows `rules_oci` 2.3.5 asking for 2.21.1, which the
pin resolves to 2.22.5.

Not verified locally:
- The system tests. All 1116 tests that depend on an `oci_*` target are
system tests under `//rs/tests`; CI runs them.
- The Rosetta Release workflow's real push to Docker Hub.
- `@ubuntu_base`. It can't be fetched on master either:
`ghcr.io/dfinity/ubuntu` no longer has the pinned digest (HTTP 404, and
the repository has no tags left). Nothing references it, so builds don't
notice, and it is left as is.

CI covers the full build and test suite.

🤖 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