Skip to content

bootc: Test ostree against the Rust libcomposefs - #408

Open
cgwalters-bot wants to merge 3 commits into
composefs:mainfrom
cgwalters-forge:bot/capi-ostree-revdep
Open

cgwalters-bot wants to merge 3 commits into
composefs:mainfrom
cgwalters-forge:bot/capi-ostree-revdep

Conversation

@cgwalters-bot

Copy link
Copy Markdown
Contributor

Stacked on cgwalters-forge#7 (ExternalPath, which keeps ostree's xx/<checksum>.file redirects), whose commit is the first one here; review only the last two. #401 (the mount fixes it was stacked on before) is merged, so its commits are gone from this branch.

Adds just bootc/test-ostree, a second matrix entry in the bootc revdep workflow. It builds the composefs RPMs from the tree (pack.sh + composefs.spec) in a CentOS Stream 10 buildroot and puts them into the packages bootc installs into its test image, so they replace the C composefs. It checks that libostree loads our libcomposefs and that the initramfs has the identical file, then runs bootc's readonly and image-upgrade-reboot plans on the ostree backend (BOOTC_variant=ostree, set explicitly).

A prep commit adds PACK_VENDOR=cargo to pack.sh, so the test vendors with the distribution's cargo vendor instead of installing rustup and an unpinned cargo-vendor-filterer. pack.sh now also fails if vendoring printed no source replacement config. The RPM build runs with CARGO_NET_OFFLINE=true, so it has to use the vendored crates.

The workflow keeps upstream's temporary if: never() (waiting on bootc-dev/bootc#2490), so neither matrix entry runs until that's lifted. The ostree entry is no longer continue-on-error, since it passes with #7.

Tested on a 16-core RHEL 10 devspace (kernel 6.12), just bootc/test-ostree at 3d53788 (the same tree as this head 708ba90, which only rewords #7's commit message). bootc was bootc-dev/bootc#2490 plus the adaptation from bot/composefs-externalpath on cgwalters-bot/bootc, since bootc doesn't build against #7 without it:

  • the RPMs build offline with PACK_VENDOR=cargo;
  • libostree uses /usr/lib64/libcomposefs.so.1.4.0 from composefs-libs-202609290233.g3d53788b2b-1.el10.x86_64, and the initramfs has the same file;
  • both tmt plans pass (plan-01-readonly, plan-24-image-upgrade-reboot): the ostree deployment boots through ostree-prepare-root on the Rust libcomposefs and survives an upgrade with a reboot.

Related: #323

The Signed-off-by: Colin Walters <walters@verbum.org> on these commits was added on cgwalters's approval of the review draft: cgwalters-forge#4 (review)

Generated-by: https://github.com/cgwalters/#llms

ostree gives each file a libcomposefs payload of `xx/<checksum>.file` and
sets the fsverity digest separately. The capi turned the payload into an
ObjectID (dropping `.file`) or ignored it when a digest was set, so the
redirect pointed at a file that doesn't exist and an ostree deployment on
the Rust libcomposefs couldn't boot.

ExternalPath carries an optional redirect as given plus an optional
verity digest, which is how libcomposefs models it. RegularFile::external()
builds it from the pair and keeps the usual composefs layout (redirect is
the digest's object path) as External, so the capi, the EROFS reader and
the dumpfile parser all normalize the same way. A digest without a payload
now stays that way everywhere, as in C: no redirect is made up for it, and
the dumpfile parser accepts it. composefs-info lists the redirect as the
object path, like C's, so ostree images don't lose their objects there.
In V2 images ExternalPath gets the same single null chunk index as
External.

Note Item::Regular's path in dumpfile_parse is now an Option, and a
redirect with an interior NUL fails the capi conversion instead of being
dropped.

The new test builds an image like ostree does via the C API and pins its
digest; `just test-capi` compares the same image against the C library.

Generated-by: AI
Signed-off-by: Colin Walters <walters@verbum.org>
pack.sh needs cargo-vendor-filterer, which isn't packaged anywhere
and gets installed unpinned with `cargo install`. `PACK_VENDOR=cargo`
uses `cargo vendor` instead, for builds that only need a working RPM
and would rather not fetch and build another tool; the vendor tarball
is bigger since it keeps every platform's crates.

Prep for building RPMs in the bootc revdep test.

Generated-by: AI
Signed-off-by: Colin Walters <walters@verbum.org>
ostree is the main C consumer of libcomposefs, and nothing tests it
against our implementation yet: the capi job only runs the C
library's own test suite. For composefs-rs to replace the C
composefs package, ostree's composefs support (writing images at
deploy time, mounting them from ostree-prepare-root) has to work
on the Rust library.

The new `just bootc/test-ostree` builds the composefs RPMs from
this checkout with pack.sh and composefs.spec (vendoring with plain
cargo) in a CentOS Stream 10 buildroot, and adds them to the
packages bootc installs into its test image. bootc installs those
from a local repository that takes priority over the distribution's,
so they replace the C composefs. It checks that libostree loads our
libcomposefs, and that the initramfs has the same library, then
runs bootc's readonly and upgrade-with-reboot tests with the ostree
backend.

The revdep workflow runs it as a second matrix entry (still behind
the workflow's temporary `if: never()`).

Generated-by: AI
Signed-off-by: Colin Walters <walters@verbum.org>

@cgwalters cgwalters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now stacks on #409 rihgt?

One thing I'd love to do is to start tryingout https://docs.github.com/en/pull-requests/how-tos/stacked-pull-requests for this stuff, give it a shot on this PR?

Comment thread contrib/packaging/pack.sh
git archive --format=tar --prefix="${PREFIX}" -o "${TAR}" HEAD

# Vendor tarball via cargo-vendor-filterer
VENDOR_CONFIG=$(cargo vendor-filterer --prefix=vendor --format=tar.zstd "${VENDORTAR}")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah let's keep this a requirement, if we're hitting inefficiency here well...yeah we should just ship it in Fedora derivatives.

But for now how about installing it as part of our github.com/bootc-dev/bootc-host-setup action ?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants