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

3959 Commits

Author SHA1 Message Date
Joseph Marrero Corchado
988fd4a46b lib: Add experimental unified storage support for install
Add an experimental --experimental-unified-storage flag to bootc install
that uses bootc's container storage (/usr/lib/bootc/storage) to pull
images first, then imports from there. This is the same approach used
for logically bound images (LBIs).

Background:
The unified storage approach allows bootc to share container images with
podman's storage, reducing disk space and enabling better integration
with podman.

Changes:
- Add --experimental-unified-storage CLI flag to install subcommands
- Add sysroot_path parameter to prepare_for_pull_unified() and pull_unified()
  to handle the different mount points during install vs upgrade/switch
- Handle container-storage transport
- Skip pull in prepare_for_pull_unified() if image already exists in
  bootc storage
- Add TMT test for install with unified storage flag
- Add TMT test for switching to unified storage on running system

The sysroot_path fix is needed because during install the target disk
is mounted at a specific path (e.g., /var/mnt), not /sysroot. Skopeo
needs the actual filesystem path to find the bootc storage.

Relates: #20

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Joseph Marrero Corchado <jmarrero@redhat.com>
2025-12-14 09:42:05 -05:00
Wei Shi
a5784832d0 lib: Add --from-downloaded flag for bootc upgrade
Add a new --from-downloaded flag to bootc upgrade that allows users to
unlock a staged deployment created with --download-only without fetching
updates from the container image source.

This provides a way to apply already-downloaded updates without triggering
a fetch operation, which is useful for scheduled maintenance workflows where
the update was downloaded earlier and should now be applied at a scheduled
time.

Usage:
  # Download update without applying
  bootc upgrade --download-only

  # Later: Apply the staged update (without fetching from image source)
  bootc upgrade --from-downloaded

  # Or: Apply staged update and reboot immediately
  bootc upgrade --from-downloaded --apply

The flag conflicts with --check and --download-only as those operations
have different purposes. It can be combined with --apply to immediately
reboot after unlocking the staged deployment.

This commit also updates the documentation (upgrades.md) to describe all
three ways to apply a download-only update, and updates the download-only
test case (test-25) to use --from-downloaded instead of plain
'bootc upgrade' when clearing the download-only flag.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Wei Shi <wshi@redhat.com>
2025-12-12 13:52:56 -05:00
Colin Walters
bf08c17584 tests: Remove composefs-bcvk test infrastructure (#1848)
The composefs-bcvk tests were a separate test path that ran integration
tests directly via bcvk. This functionality is now covered by the
tmt-based testing framework, so remove the redundant infrastructure.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-12 13:52:41 +08: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
Colin Walters
5a1243fbae build-sys: Also inject hvc0 to sealed images
This would really be fixed by having `boot container ukify`.

Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-11 14:43:26 -05:00
Pragyan Poudyal
369859d61c composefs: Backwards compatibility for fetching image info
For older systems that do not have the `.imginfo` file, we revert back
to our older logic of fetching the image info from registry

We then store this in an `.imginfo` file so we don't go and make a
network call on every subsequent command

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-11 09:37:46 -05:00
Pragyan Poudyal
9f563057ac composefs/state: Require container details when writing state
Make `container_details` argument mandatory while writing composefs
deployment state.

It's better to fetch the container details from the source imgref,
rather than the target imgref, as the target might not even exist at the
time of deployment.

Fixes CI failures as we were fetching from local registry (according to
the target imgref), which doesn't exist

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-11 09:37:46 -05:00
Pragyan Poudyal
229460a9a9 composefs: Use ManifestDiff for getting manifest diff
Now that we store the current deployment's manifest locally, we can
replace the ugly stuff with a simple call to `ManifestDiff::new`

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-11 09:37:46 -05:00
Pragyan Poudyal
c006368610 composefs: Store image manifest and config
Until now, when doing a `bootc status` for a compoesfs booted system, we
were reaching out a container registry to fetch image manifest and
config, which is pretty suboptimal as the command took upwards of 1.5s
to execute, sometimes.

Instead, now we store the manifest + config as a JSON structure inside
an `.imginfo` file alongside the `.origin` file

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-11 09:37:46 -05:00
Pragyan Poudyal
cc99b4e71d composefs/usroverlay: Get mode from underlying /usr
We'd want to do this as the permissions for /usr might be different on
different distros

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-11 07:28:28 -05:00
Wei Shi
ebe7f6386c lib/composefs: Add error check for unsupported --download-only flag
The previous commit (c325582f) added --download-only support for the
OSTree backend but did not add an error check for the composefs backend
where this feature is not yet implemented.

This commit adds a proper error message at the start of upgrade_composefs()
to explicitly bail out when --download-only is used, matching the pattern
used for other unsupported composefs features like --mutate-in-place and
edit operations.

Without this check, the flag would be silently ignored, potentially
causing confusion for users expecting download-only behavior.

Error message: "--download-only is not yet supported for composefs backend"

Signed-off-by: Wei Shi <wshi@redhat.com>
2025-12-11 16:03:26 +05:30
Wei Shi
c325582f50 lib: Add --download-only flag for upgrade
Add support for downloading and staging updates without automatic
application on reboot. This allows users to prepare updates and apply
them at a controlled time.

User-facing changes:
- Add --download-only flag to bootc upgrade command
- bootc upgrade --download-only: stages deployment in download-only mode
- bootc upgrade (no flags): clears download-only mode if present
- bootc upgrade --apply: clears download-only mode and immediately reboots
- bootc upgrade --check: read-only, doesn't change download-only state
- bootc status shows "Download-only: yes/no" for staged deployments in verbose mode
- Garbage collection automatically cleans up unreferenced images after staging

Implementation details:
- Internally uses OSTree finalization locking APIs
- Sets opts.locked in SysrootDeployTreeOpts when staging deployments
- Added change_finalization() method to SysrootLock wrapper
- Tracks lock state changes separately from image digest changes
- Field name in BootEntry is download_only (Rust), downloadOnly (JSON)
- Verbose status display uses "Download-only" label (matches Soft-reboot pattern)
- Uses deployment.is_finalization_locked() API (OSTree v2023.8+)
- Always emits downloadOnly field in JSON output for consistency

Testing and documentation:
- New dedicated test: test-25-download-only-upgrade.nu (4-boot workflow)
- Test verifies: switch → upgrade --download-only → reboot (stays old) →
  re-stage → upgrade (clear) → reboot (applies)
- Updated docs/src/upgrades.md with comprehensive workflow examples
- Includes notes about reboot behavior and image switching
- Generated man pages and JSON schemas updated
- All test fixtures updated with downloadOnly field

The download-only flag is only available for upgrade, not switch.
The implementation is designed to support future composefs backend.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Wei Shi <wshi@redhat.com>
2025-12-10 12:58:38 -05:00
Xiaofeng Wang
3a7dd85ff1 test: Update to work with OSCI gating test
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-10 11:12:56 -05:00
bootc-bot[bot]
8c0c2f6299 chore(deps): update github actions (#1841)
Signed-off-by: bootc-bot[bot] <225049296+bootc-bot[bot]@users.noreply.github.com>
Co-authored-by: bootc-bot[bot] <225049296+bootc-bot[bot]@users.noreply.github.com>
2025-12-10 16:03:24 +08:00
ckyrouac
1c13b9399e install: Allow mounted directories during install to-filesystem
When performing a to-filesystem installation, the target directory may
contain pre-existing mount points for directories like /var, /var/lib/containers,
etc. These are legitimate in hybrid/existing filesystem scenarios where certain
directories are on separate partitions.

This change enhances the empty rootdir check to:
- Recursively detect directories that contain only mount points
- Skip directories that are themselves mount points
- Allow installation to proceed when mount hierarchies exist (e.g., /var
  containing /var/lib which contains mounted /var/lib/containers)

Also adds integration test coverage for separate /var mount scenarios using LVM.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: ckyrouac <ckyrouac@redhat.com>
2025-12-09 13:44:54 -05:00
Huijing Hei
64eef42d92 crates/utils: update version to 0.1.0
Signed-off-by: Huijing Hei <hhei@redhat.com>
2025-12-09 08:35:47 -05:00
Huijing Hei
5df230ae6a crates/blockdev: publish new version 0.1.0
Signed-off-by: Huijing Hei <hhei@redhat.com>
2025-12-09 08:35:47 -05:00
Pragyan Poudyal
f846a95473 composefs/usr: Fix /usr permissions on overlay mount
The upper,work directories being created for `/usr` transient mount
always had the mode `0o700` hence only being accessible to root

Update `bootc_initramfs_setup::ensure_dir` to accept an optional
`mode` argument

Fixes: https://github.com/bootc-dev/bootc/issues/1833

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-09 06:49:51 -05:00
Xiaofeng Wang
6391cf83e3 test: Add more delay for bootc to settle and avoid flaky (#1817)
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-09 14:10:23 +08:00
John Eckersberg
d92423cc80 docs: Replace autogenerated TODO in bootc-container-inspect
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-12-08 18:15:16 -05:00
John Eckersberg
25f8531702 Run cargo xtask update-generated
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-12-08 18:15:16 -05:00
John Eckersberg
576913886f cli: Add container inspect
Prints JSON of container metadata/attributes of interest.

For now this just renders out the kargs embedded in the container
under the kargs.d drop-in.  Future ideas for enhancements would be to
include kernel version and whether or not the image uses a UKI.

Closes: #1827
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-12-08 18:15:16 -05:00
bootc-bot[bot]
dd018a9fa7 chore(deps): update actions/download-artifact action to v6
Signed-off-by: bootc-bot[bot] <225049296+bootc-bot[bot]@users.noreply.github.com>
2025-12-08 16:43:58 -05:00
Xiaofeng Wang
6a9309e47b test: Check rpm-ostree and rpm-ostreed service status
And collect info for flaky "error: System transaction in progress"

Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
47f237099c ci: Fix Permission denied error for cargo build
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
66ac4d8a90 Justfile: Fix unbound buildroot_base issue
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
b20c6ed340 test: Fix Dockerfile ARG issue
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
97e0f5d5c4 ci: Fix remove target folder permission issue in Test install
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
f9e57bf522 test: Fix composefs test image build issue
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
45f31416d3 ci: No copy RPM package required
The download-artifact already save RPMs into target/packages/

Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
e6a23fe7e4 ci: Fix RPM version
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Xiaofeng Wang
a7e32db46a test: Fix justfile issue and add fedora-44 into test_os
Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
2025-12-08 09:25:29 -05:00
Colin Walters
54284f841a ci: Split RPM building into separate job
This splits the RPM package building into a separate CI job that runs
before the integration tests. The built packages are then downloaded
and used by the integration test jobs, avoiding redundant builds.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-08 09:25:29 -05:00
bootc-bot[bot]
3f5a3c7291 Release 1.11.0
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v1.11.0
2025-12-05 13:12:05 -05:00
Colin Walters
e71787f79f ci: Unify test-integration jobs into single matrix
Consolidate test-integration and test-integration-cfs into a single job
using a unified matrix (test_os × variant) matching the structure of
build-and-publish.yml. This eliminates code duplication and simplifies
maintenance.

Updated required-checks sentinel to depend only on the unified job.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-05 07:37:50 -05:00
Colin Walters
094c39d718 ci: Split image publishing into separate workflow for security
Previously, the CI workflow granted packages:write permission at the
workflow level, making GITHUB_TOKEN with write access available to all
jobs including those running on pull requests. While the actual push
steps were gated with conditionals, malicious PR code could use the
token to push arbitrary images to ghcr.io.

Split image publishing into a dedicated build-and-publish.yml workflow
that only runs on push to main, with no PR execution. This follows
GitHub security best practices by isolating write credentials from
untrusted PR code.

The new workflow builds and publishes all image variants using a simple
matrix with explicit exclude for centos-9 UKI (broken per #1812).

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-12-05 07:37:50 -05:00
Michael Vogt
136593a39d tests: add test_bootc_install_config_all integration test
This adds a simple integration test for
```
$ bootc install print-configuration --all
```
in the container tests.

Thanks to Colin for suggesting this.

Signed-off-by: Michael Vogt <michael.vogt@gmail.com>
2025-12-04 20:58:14 -05:00
Michael Vogt
d84443de00 cli: add install print-configuration --all
When `install print-configuration` is run some options (notably
the kargs) are currently filtered out. This makes sense because
in general `bootc install to-filesystem` takes care of them.

However with the recent work in image-builder/osbuild to use
bootc containers directly as inputs to build ISOs [0],[1]
we would like to get access to the kernel args too because
when constructing a bootable ISO we also want to add the
bootc container kargs.

[0] https://github.com/orgs/osbuild/discussions/45
[1] https://github.com/osbuild/images/pull/1906

Signed-off-by: Michael Vogt <michael.vogt@gmail.com>
2025-12-04 20:58:14 -05:00
John Eckersberg
f8dab48077 Fix one remaining instance of 114800 baud rate
Signed-off-by: John Eckersberg <jeckersb@redhat.com>
2025-12-03 16:28:23 -05:00
bootc-bot[bot]
d82f26a989 chore(deps): update github actions
Signed-off-by: bootc-bot[bot] <225049296+bootc-bot[bot]@users.noreply.github.com>
2025-12-03 15:17:38 -05:00
bootc-dev Bot
a4bda72d48 Sync common files from infra repository
Synchronized from bootc-dev/infra@10decade10.

Signed-off-by: bootc-dev Bot <bot@bootc.dev>
2025-12-02 17:14:48 -05:00
Pragyan Poudyal
2c34df6860 project: Fix typos
Fix a few typos across the project. Also update some comments/error
messages

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-01 13:47:16 -05:00
Pragyan Poudyal
815810d7ab kargs: Update kargs computing function name
Rename the function `kargs_from_composefs_filesystem` to
`compute_new_kargs` as it now has nothing to do with composefs

Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
2025-12-01 13:47:16 -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
c797b37541 composefs/boot: Clean up BLS sort-key and filename ordering
Improve boot entry ordering to work correctly across both Grub and systemd-boot
bootloaders, which have fundamentally different sorting behaviors.

Background:
Grub does not read BLS fields - it parses the filename as an RPM package name
using split_package_string(). The parsing splits on `-` from right to left:
1. Strip .conf suffix
2. Find LAST `-` → extract "release" field
3. Find SECOND-TO-LAST `-` → extract "version" field
4. Remainder → "name" field
5. Sort by (name, version, release) in DESCENDING order

See: https://github.com/ostreedev/ostree/issues/2961

Changes:
- Add comprehensive module documentation explaining bootloader sorting behaviors
- Parse os-release to extract ID field (e.g., "fedora", "rhel")
- Filename format: `bootc_{os_id}-{version}-{priority}.conf`
  * Replace `-` with `_` in os_id to prevent Grub mis-parsing
  * Priority in release position for Grub compatibility
  * Primary: `bootc_fedora-41.20251125.0-1.conf`
  * Secondary: `bootc_fedora-41.20251124.0-0.conf`
- Sort-key format for systemd-boot:
  * Primary: `bootc-{os_id}-0` (sorts first)
  * Secondary: `bootc-{os_id}-1` (sorts second)
- Update rollback logic for new filename format
- Add comprehensive unit tests

Boot entry ordering after upgrade (both bootloaders):
1. Primary: New/upgraded deployment (default boot target)
2. Secondary: Currently booted deployment (rollback option)

Sorting behavior:
- Grub: Descending by (name, version, release) from filename parsing
- Systemd-boot: Ascending by sort-key field, filename mostly irrelevant

Fixes: #1777
Related: https://github.com/ostreedev/ostree/issues/2961

Signed-off-by: Colin Walters <walters@verbum.org>
Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-26 11:13:10 +05:30
Colin Walters
0a36eb1d84 xtask: Add distro-aware bind-storage-ro support for tmt tests
CentOS 9 lacks systemd.extra-unit.* support which is required for
--bind-storage-ro to work with bcvk. This was causing test failures
on centos-9 while working fine on Fedora.

Change the approach so tests express intent via `extra.try_bind_storage: true`
metadata, and xtask handles the details:

- Detect distro by running the container image and parsing os-release
- Pass distro to tmt via --context=distro=<id>-<version>
- Only add --bind-storage-ro when test wants it AND distro supports it
- When bind storage is available, also set BOOTC_upgrade_image env var
- Tests can detect missing $env.BOOTC_upgrade_image and fall back to
  building the upgrade image locally

Add --upgrade-image CLI option to specify the upgrade image path,
replacing the old --env=BOOTC_upgrade_image approach.

Extract magic values to clear const declarations at the top of the file
for better maintainability.

Assisted-by: Claude Code (Sonnet 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-25 22:48:37 -05:00
Colin Walters
6a077f0368 ci: Expand composefs testing to include upgrade
Signed-off-by: Colin Walters <walters@verbum.org>
2025-11-25 22:48:37 -05:00