1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 15:45:53 +01:00

138 Commits

Author SHA1 Message Date
Colin Walters
3efcbddeb3 lib: Fix bootc status on non-bootc systems
Previously, `BootedStorage::new()` unconditionally tried to open
`/sysroot` before checking the environment type. This caused
`bootc status` to fail on non-ostree/composefs systems.

(We did work in containers and we had tests for that; but
 the container case is special cased even earlier)

Fixes: https://issues.redhat.com/browse/RHEL-135687

Assisted-by: Claude Code (Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-14 10:06:53 -05:00
Colin Walters
6f69534f9b Rework sealed build process
Main goal is to reduce signing logic duplication between the systemd-boot
and UKI generation.

However, this quickly snowballed into wanting to actually verify
by providing a custom secure boot keys to bcvk that things worked.
This depends on https://github.com/bootc-dev/bcvk/pull/170

Now as part of that, I ran into what I think are bugs in pesign;
this cuts things back over to using sbsign. I'll file a tracker for that
separately.

Finally as part of this, just remove the TMT example that builds
a sealed image but doesn't actually verify it works - it's already
drifted from what we do outside here. Ultimately what we need
is to shift some of this into the Fedora examples and we just
fetch it here anyways.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-11 14:43:26 -05:00
Gareth Widlansky
089dedcc1c Fix systemd-boot signing on sealed image test
Signed-off-by: Gareth Widlansky <gareth.widlansky@proton.me>
Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-11 14:43:26 -05:00
Wei Shi
b017a9b364 Update tests/build-sealed
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Wei Shi <wshi@redhat.com>
2025-12-01 13:46:24 -05:00
Wei Shi
66203c207b Fix undefined BOOTC_buildroot_base in build-sealed script
The build-sealed script introduced in PR #1810 referenced
BOOTC_buildroot_base which is only defined in GitHub Actions CI,
causing failures when running 'just build-sealed' manually.

This allows manual execution while maintaining CI compatibility.

Signed-off-by: Wei Shi <wshi@redhat.com>
2025-12-01 13:46:24 -05:00
Xiaofeng Wang
f687add625 test: Add more distros for composefs test (#1810)
And ignore test-integration-cfs failure on centos-9

Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-11-27 13:31:31 +08:00
Colin Walters
f8ce015254 Rework GHA testing: Use bcvk, cover composefs with tmt
Part 1: Use bcvk

For local tests, right now testcloud+tmt doesn't support UEFI, see
https://github.com/teemtee/tmt/issues/4203

This is a blocker for us doing more testing with UKIs.

In this patch we switch to provisioning VMs with bcvk, which
fixes this - but beyond that a really compelling thing about
this is that bcvk is *also* designed to be ergonomic and efficient
beyond just being a test runner, with things like virtiofs
mounting of host container storage, etc.

In other words, bcvk is the preferred way to run local virt
with bootc, and this makes our TMT tests use it.

Now a major downside of this though is we're effectively
implementing a new "provisioner" for tmt (bypassing the
existing `virtual`). In the more medium term I think we
want to add `bcvk` as a provisioner option to tmt.

Anyways for now, this works by discovers test plans via `tmt plan ls`,
spawning a separate VM per test, and then using uses tmt's connect
provisioner to run tests targeting these externally provisioned
systems.

Part 2: Rework the Justfile and Dockerfile

This adds `base` and `variant` arguments which are propagated through
the system, and we have a new `variant` for sealed composefs.

The readonly tests now pass with composefs.

Drop the continuous repo tests...as while we could keep
that it's actually a whole *other* entry in this matrix.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-06 19:32:42 -05:00
Colin Walters
02fb561e43 tests: Use systemd-i128 over uuidgen
`just test-composefs` fails in the new default devcontainer
ref <https://github.com/bootc-dev/infra/blob/main/common/.devcontainer>
without this.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-10-31 17:41:53 -04:00
Colin Walters
a043c8e9b1 ci: Just use one job for build + test
In the future, we may want to "shard" tests across multiple runners,
but as is right now it's basically just adding overhead to copy
the disk image as an artifact across the job.

While we're here, clean things up further to match the general
principle that GHA flows should mostly just be running `just`.
The logic from build.sh to map from strings -> containers though
moves into the GHA for now.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-10-30 17:27:27 -04:00
Colin Walters
f4c678eb88 Various composefs enhancements
- Change the install logic to detect UKIs and automatically
  enable composefs
- Change the install logic to detect absence of bootupd
  and default to installing systemd-boot
- Move sealing bits to the toplevel
- Add Justfile entrypoints
- Add basic end-to-end CI coverage (install + run) using
  our integration tests
- Change lints to ignore `/boot/EFI`

Signed-off-by: Colin Walters <walters@verbum.org>
2025-10-16 14:48:21 -04:00
Colin Walters
7e526508a9 ci: Use bcvk
Make builds unprivileged by default and start using bcvk in
our own CI, the same way we expect people to do so locally
now.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-10-15 08:34:52 -04:00
Xiaofeng Wang
f1dec83720 test: Use SRPM as test code source to work with gating test (#1670)
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-10-08 11:47:44 +08:00
Colin Walters
de3c29fce0 ci: Move disk wrapper into Justfile
So it can be executed more generically on any container image as
input and write to output.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-10-07 21:49:08 -04:00
John Eckersberg
db8d7bbf6e Use ext4 by default when building integration disk image
By default bootc will enable fsverity when ext4 is the chosen
filesystem, and we need fsverity to do composefs testing.

Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-09-29 16:49:13 -04:00
Colin Walters
d81c395fce ci: Unify more of hack/ and tests/
A key thing for me is that the `Justfile` should be a one-stop
shop for development of the project. It can't have everything but
it should answer the basic questions of "how do I build and test
this project".

This aligns the recently added tmt-on-GHA flow a *bit* more closely
with some of that. Biggest is to use the `just build-integration-test-image` as the canonical
way to build a container image with our testing stuff in it;
which uses our main Dockerfile

Other cleanups:
- Change test script to move into tests/tmt/ as a workaround for
  https://github.com/teemtee/tmt/pull/3037#issuecomment-3259585271
- Change the qemu logic to use SMBIOS credentials so we don't
  have to carry around both a disk image and a SSH key
- Change qemu to use `-snapshot` so we can reuse disks
- Change the scripts to accept data via argv[1] and not environment
- Drop the hardcoded testing directory and use `target/` as
  a generic build artifact dir

Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-17 15:20:06 -04:00
Colin Walters
a3a28fdff2 integration: Copy distro-sync from main Dockerfile
Over in https://github.com/bootc-dev/bootc/pull/1607
I actually *just* deduplicated this code, but that isn't
ready to merge yet.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-09-12 13:07:04 -04:00
Xiaofeng Wang
cc53ba16a4 test: Run script with sudo instead of adding sudo in script
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-09-10 20:55:00 +08:00
Xiaofeng Wang
54f8562dad test: Add integration test running on github runner
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-09-10 20:55:00 +08:00
Colin Walters
d4c19f7d31 tests: Add a suite which runs tests under systemd
And add a single test which verifies that our internal `reboot`
code actually does what it should (via systemd-run etc.)

This took me way, way too long to do...there were so many missteps
and confusion. First of all, I kept trying to use `systemd.extra-unit`
from https://www.freedesktop.org/software/systemd/man/latest/systemd-debug-generator.html#
but that doesn't exist in stream9.

I spent way too long trying to debug the fact that switching from
`podman run <image> /sbin/init` to `podman run <image> /bin/sh -c '<stuff> && exec /sbin/init`
fails because in the latter case podman's auto-detection fails and
we need to explicitly say `--systemd=always`. In retrospect obvious...but oh well.

On the positive side, I think with some cleanup we could extend this model
and generalize it for "test running in a container with systemd" (with
a lot of cleanup really)

Signed-off-by: Colin Walters <walters@verbum.org>
2025-07-18 07:42:05 -04:00
Xiaofeng Wang
ffa709f222 test: drop nested virt required on integration test
Use TF runner as test machine and run all test on TF runner itself

Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-04-04 01:13:21 +08:00
Colin Walters
2da6f88b85 lsm, imgstorage: Rework relabeling
The previous work here wasn't quite right in a few ways.
Our LSM/SELinux code is a bit complex and under-tested.

Here we:

First, refactor some of the labeling bits so we have a clean
"relabel this file" API.

For the bootc-owned containers-storage we don't want
"recursive create dir and relabel" in the general case - we
need to handle upgrades, where there are definitely
non-directories too.

Hence rework the API to just be a clean recursive
relabeling pass, don't attempt to create anything
on our own.

The install path hence changes to let podman create
the dirs first, then we relabel.

While we're here:

- Rework the recursive traversal to operate on shared
  single `&mut` path buffers to avoid a heap alloc per directory.
- Add a `bootc internals relabel` CLI verb that
  makes it easy to test this code both interactively
  and in integration testing.
- Add a test case

Closes: https://github.com/bootc-dev/bootc/issues/1219

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-22 15:01:06 -04:00
Robert Sturla
ce3bb65e5d tests(status): add tests for --booted
Signed-off-by: Robert Sturla <robertsturla@outlook.com>
2025-03-19 01:46:21 +00:00
ckyrouac
4b2ade55fa imgstorage: Set selinux labels for imgstorage
Running some containers (e.g. mssql) requires the imgstorage labels to
be identical to the /var/lib/containers/storage. So, this code
recursively sets the labels for the bootc storage directory to mimic
/var/lib/containers/storage. This operation is done once, then a
.bootc_labeled file is created to signify the directory was labeled.
This operation could be done anytime the storage is
accessed, i.e. on installation, upgrade, or running a `bootc image`
command.

Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-03-18 10:08:27 -04:00
Colin Walters
7145132ea2 internals: Add new bootc internals fsck
Split this out of the fsverity PR.

We obviously want a `fsck` command. This starts by doing
just two checks:

- A verification of `etc/resolv.conf`; this tests
  98995f662b
- Just run `ostree fsck`

But obvious things we should be adding here are:

- Verifying kargs
- Verifying LBIs

etc.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-10 13:46:18 -04:00
Valentin Rothberg
b233fe0db2 Merge pull request #1169 from cgwalters/readonly-test
tests: Fix naming of readonly tests
2025-03-06 11:10:11 +01:00
Colin Walters
967a238e2a tests: Fix naming of readonly tests
This ensures the tests actually run...

Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-05 17:38:04 -05:00
Colin Walters
98995f662b store: Really remove empty /etc/resolv.conf and /etc/hostname
The previous change here was a no-op for two reasons:

- It's actually usr/etc at this point
- We were operating on the wrong rootfs

Fixes: 57bd0dc983
Signed-off-by: Colin Walters <walters@verbum.org>
2025-03-05 14:52:56 -05:00
Colin Walters
37d9b6ee5a Revert "tests: Work around podman/skopeo interaction bug"
This reverts commit 6324840d7a.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-12 14:58:54 -05:00
Colin Walters
6324840d7a tests: Work around podman/skopeo interaction bug
See https://github.com/containers/bootc/pull/1101#issuecomment-2653862974
Basically things break unless "podman" initializes the c/storage instance right now.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-12 12:51:41 -05:00
Colin Walters
57bd0dc983 store: Clean up broken /etc/hostname and /etc/resolv.conf
We can pretty safely work around this here; zero sized
files for both are useless.

Closes: https://github.com/containers/bootc/issues/1064
Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-07 11:33:12 -05:00
Colin Walters
cb99cf5c95 ci: Bump Fedora to 41
For newer ostree

Signed-off-by: Colin Walters <walters@verbum.org>
2025-02-03 12:37:38 -05:00
Colin Walters
8990b54244 build.sh: Use our embedded spec
One CI run just got a server error fetching the spec from Fedora.
We have a spec here (which I don't like but we do) so use it
to lower CI flakes.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-01-17 09:55:22 -05:00
Colin Walters
63d1199e44 progress: Emit a Start message with API version, drop from fields
And use a semantic version for the API version as this allows
a clearer evolution.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-01-08 15:23:04 -05:00
Colin Walters
38e59c52e4 cli: Rename --json-fd to --progress-fd
The format is not as important as what the option *does*. There's
multiple things that can be JSON, but this is specifically
about dynamic progress information.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-01-08 13:24:49 -05:00
Colin Walters
d9f1c01fc7 tests: Add some sanity checking of --json-fd
We could add a new test case for this, but it's expensive to
do these image push/pull ones so let's just pile onto this one.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-01-07 20:59:18 -05:00
Colin Walters
cb10398851 build-sys: Enable bootc-status-updated.path by default
Followup to https://github.com/containers/bootc/pull/977

In chatting with John we had some agreement to statically
enable the `.path` unit by default upstream here since
it's a feature we want to be available by default
so that tooling can react dynamically to changes.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-01-06 15:30:23 -05:00
Colin Walters
36854dc6e7 tests: Verify mtime changes
This could be its own whole new test, but it's simple
enough to add one here.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-20 08:28:39 -05:00
Xiaofeng Wang
3aada94752 test: Remove tmt bootc plugin code and use released bootc plugin
Remove tests-intetration folder because TMT bootc plugin replaces
tests-integration

Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2024-12-07 14:33:13 +08:00
Colin Walters
3b61d2cadc Drop copy of tmt bootc plugin
It's now merged and shipped, and us having a copy breaks things.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-05 13:56:36 -05:00
Colin Walters
28e85e6316 tests: Adapt for newer nushell
It looks like the default `column1` became `column0` which
broke this. But really we don't need a table, we just need a list;
and piping to `from csv` was a weird way to go about splitting
lines into a list.

Change the assertion to just expect a list which simplifies
the code.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-05 13:56:36 -05:00
Xiaofeng Wang
8f0f3d2d88 test: Remove e2e test
xref: https://github.com/containers/bootc/issues/868

Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2024-12-04 08:28:54 -05:00
Colin Walters
32612035d5 tests: Drop more bind mount instances
These should be unnecessary.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-02 18:11:52 -05:00
Colin Walters
99ef63508d Drop test references to /dev and /var/lib/containers mounts
Keep the bind mounts in the docs though for now because many
people will be using the current docs with older bootc.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-12-02 18:11:52 -05:00
John Eckersberg
0ff93f8dd1 Merge pull request #911 from cgwalters/fix-nushell-syntax
tests: Fix syntax error from newer nushell
2024-11-20 11:14:28 -05:00
Omer Tuchfeld
60a6f0b3eb List logically bound images
Solves the second part of https://github.com/containers/bootc/issues/846

The (hidden) image list command now has a `--type` flag to allow users
to list only logical images, only host images, or all images.

Also the command has been adjusted so that it can run even when not
booted off of a bootc system. In that case, it will only list logical
images. If a user tries to list host images without a booted system, an
error will be thrown.

The command also has a `--format` flag to allow users to choose between
a human-readable table format and a JSON format.

Signed-off-by: Omer Tuchfeld <omer@tuchfeld.dev>
2024-11-19 23:07:47 +01:00
Colin Walters
6f80efe6dd tests: Fix syntax error from newer nushell
Updated versions of nu make this a syntax error apparently.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-11-19 14:47:20 -05:00
Chris Kyrouac
c0c4ccf8ee install: Check if running in container earlier
Previously, the check to verify install to-filesystem is being run
within a container happened fairly late in prepare_install. This moves
the check up before some of the other container specific checks. Now,
the error should occur when trying a basic install to-filesystem
invocation, e.g. `bootc install to-filesystem /var/mnt`.

This also adds a test to verify the error occurs with minimal arguments
and adds host_is_container to the global state.

Signed-off-by: Chris Kyrouac <ckyrouac@redhat.com>
2024-11-08 16:32:31 -05:00
Colin Walters
a8356de2ea cli: Wrap ostree-ext via bootc internals
Today rpm-ostree exposes the `ostree container` verb. As part of
taking over from rpm-ostree we need to do the same.

Followup to merging ostree-rs-ext in this repository.

A next step here is for us to start owning the
/usr/libexec/libostree/ext/ostree-container
symlink but that will be a followup.

Signed-off-by: Colin Walters <walters@verbum.org>
2024-11-08 11:50:27 -05:00
Colin Walters
8fc788bf43 tests: Drop python tests
It's not useful to have two frameworks here, let's just use nushell.
ref https://github.com/containers/bootc/issues/868

Signed-off-by: Colin Walters <walters@verbum.org>
2024-11-06 17:25:27 -05:00
Chris Kyrouac
140eeacb17 tmt: Add new tmt scripts path to $PATH
Signed-off-by: Chris Kyrouac <ckyrouac@redhat.com>
2024-10-31 14:44:36 -04:00