Skip to content

Commit 3a98558

Browse files
committed
container: Add export --format=tar command
Some people want to use container build tools, but for compatibility with older systems export a tar format of the OS state e.g. Anaconda liveimg expects this. Basically this is only *slightly* more than just `tar cf`; we need to handle SELinux labeling and move the kernel. Note in order to test this we grew a whole new anaconda.rs, but this is mitigated for now by moving most of the qemu logic into bcvk. Ref: #1957 Assisted-by: OpenCode (Sonnet 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent d6a2b7a commit 3a98558

File tree

13 files changed

+1695
-4
lines changed

13 files changed

+1695
-4
lines changed

.github/workflows/ci.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,45 @@ jobs:
304304
name: tmt-log-PR-${{ github.event.number }}-fedora-43-coreos-${{ env.ARCH }}
305305
path: /var/tmp/tmt
306306

307+
# Test the container export -> Anaconda liveimg install path.
308+
# Builds localhost/bootc, exports as tarball, installs via Anaconda in QEMU,
309+
# and verifies the resulting disk boots.
310+
test-container-export:
311+
needs: package
312+
runs-on: ubuntu-24.04
313+
314+
steps:
315+
- uses: actions/checkout@v6
316+
- name: Bootc Ubuntu Setup
317+
uses: bootc-dev/actions/bootc-ubuntu-setup@main
318+
with:
319+
libvirt: true
320+
321+
- name: Setup env
322+
run: |
323+
echo "BOOTC_base=quay.io/centos-bootc/centos-bootc:stream10" >> $GITHUB_ENV
324+
325+
- name: Download package artifacts
326+
uses: actions/download-artifact@v7
327+
with:
328+
name: packages-centos-10
329+
path: target/packages/
330+
331+
- name: Build and run container export test
332+
run: |
333+
BOOTC_SKIP_PACKAGE=1 just test-container-export
334+
335+
- name: Archive test logs
336+
if: always()
337+
uses: actions/upload-artifact@v6
338+
with:
339+
name: container-export-test-${{ env.ARCH }}
340+
path: target/anaconda-test/*.log
341+
307342
# Sentinel job for required checks - configure this job name in repository settings
308343
required-checks:
309344
if: always()
310-
needs: [cargo-deny, validate, package, test-integration, test-coreos]
345+
needs: [cargo-deny, validate, package, test-integration, test-coreos, test-container-export]
311346
runs-on: ubuntu-latest
312347
steps:
313348
- run: exit 1
@@ -316,4 +351,5 @@ jobs:
316351
needs.validate.result != 'success' ||
317352
needs.package.result != 'success' ||
318353
needs.test-integration.result != 'success' ||
319-
needs.test-coreos.result != 'success'
354+
needs.test-coreos.result != 'success' ||
355+
needs.test-container-export.result != 'success'

Cargo.lock

Lines changed: 148 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Justfile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ test-tmt *ARGS: build
108108
[group('core')]
109109
test-container: build build-units
110110
podman run --rm --read-only localhost/bootc-units /usr/bin/bootc-units
111-
podman run --rm --env=BOOTC_variant={{variant}} --env=BOOTC_base={{base}} {{base_img}} bootc-integration-tests container
111+
podman run --rm --env=BOOTC_variant={{variant}} --env=BOOTC_base={{base}} --mount=type=image,source={{base_img}},target=/run/target {{base_img}} bootc-integration-tests container
112112

113113
# Build and test sealed composefs images
114114
[group('core')]
@@ -138,6 +138,28 @@ test-composefs-grub filesystem:
138138
validate:
139139
podman build {{base_buildargs}} --target validate .
140140

141+
# Test container export via Anaconda liveimg install in a QEMU VM
142+
[group('testing')]
143+
test-container-export: build
144+
#!/bin/bash
145+
set -xeuo pipefail
146+
iso=target/anaconda-test/boot.iso
147+
if [ ! -f "$iso" ]; then
148+
# Determine the ISO download URL from the base image's os-release
149+
eval $(podman run --rm {{base_img}} bash -c '. /etc/os-release && echo "ID=$ID VERSION_ID=$VERSION_ID"')
150+
case "${ID}-${VERSION_ID}" in
151+
centos-10)
152+
url="https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/iso/CentOS-Stream-10-latest-x86_64-boot.iso" ;;
153+
fedora-*)
154+
url="https://download.fedoraproject.org/pub/fedora/linux/releases/${VERSION_ID}/Everything/x86_64/iso/Fedora-Everything-netinst-x86_64-${VERSION_ID}-1.1.iso" ;;
155+
*)
156+
echo "Unsupported OS: ${ID}-${VERSION_ID}" >&2; exit 1 ;;
157+
esac
158+
mkdir -p target/anaconda-test
159+
curl -L --retry 3 --progress-bar -o "$iso" "$url"
160+
fi
161+
cargo run -p tests-integration -- anaconda-test --iso "$iso" {{base_img}}
162+
141163
# ============================================================================
142164
# Testing variants and utilities
143165
# ============================================================================

0 commit comments

Comments
 (0)