Skip to content

Commit d9bb93d

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 5e5a341 commit d9bb93d

File tree

13 files changed

+1674
-4
lines changed

13 files changed

+1674
-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
@@ -114,7 +114,7 @@ test-tmt *ARGS: build
114114
[group('core')]
115115
test-container: build build-units
116116
podman run --rm --read-only localhost/bootc-units /usr/bin/bootc-units
117-
podman run --rm --env=BOOTC_variant={{variant}} --env=BOOTC_base={{base}} --env=BOOTC_boot_type={{boot_type}} {{base_img}} bootc-integration-tests container
117+
podman run --rm --env=BOOTC_variant={{variant}} --env=BOOTC_base={{base}} --env=BOOTC_boot_type={{boot_type}} --mount=type=image,source={{base_img}},target=/run/target {{base_img}} bootc-integration-tests container
118118

119119
[group('core')]
120120
test-composefs bootloader filesystem boot_type seal_state *ARGS:
@@ -146,6 +146,28 @@ test-composefs bootloader filesystem boot_type seal_state *ARGS:
146146
validate:
147147
podman build {{base_buildargs}} --target validate .
148148

149+
# Test container export via Anaconda liveimg install in a QEMU VM
150+
[group('testing')]
151+
test-container-export: build
152+
#!/bin/bash
153+
set -xeuo pipefail
154+
iso=target/anaconda-test/boot.iso
155+
if [ ! -f "$iso" ]; then
156+
# Determine the ISO download URL from the base image's os-release
157+
eval $(podman run --rm {{base_img}} bash -c '. /etc/os-release && echo "ID=$ID VERSION_ID=$VERSION_ID"')
158+
case "${ID}-${VERSION_ID}" in
159+
centos-10)
160+
url="https://mirror.stream.centos.org/10-stream/BaseOS/x86_64/iso/CentOS-Stream-10-latest-x86_64-boot.iso" ;;
161+
fedora-*)
162+
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" ;;
163+
*)
164+
echo "Unsupported OS: ${ID}-${VERSION_ID}" >&2; exit 1 ;;
165+
esac
166+
mkdir -p target/anaconda-test
167+
curl -L --retry 3 --progress-bar -o "$iso" "$url"
168+
fi
169+
cargo run -p tests-integration -- anaconda-test --iso "$iso" {{base_img}}
170+
149171
# ============================================================================
150172
# Testing variants and utilities
151173
# ============================================================================

0 commit comments

Comments
 (0)