diff --git a/.packit.yaml b/.packit.yaml index d4726eda3..c2cd44288 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -59,10 +59,6 @@ jobs: owner: rhcontainerbot project: bootc enable_net: true - # TODO - notifications: - failure_comment: - message: "bootc Copr build failed for {commit_sha}. @admin check logs {logs_url} and packit dashboard {packit_dashboard_url}" - job: tests trigger: pull_request diff --git a/Dockerfile b/Dockerfile index 66f97342f..15e812533 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,14 @@ -# Build this project from source and drop the updated content on to -# a bootc container image. By default we use CentOS Stream 9 as a base; -# use e.g. --build-arg=base=quay.io/fedora/fedora-bootc:41 to target +# Build this project from source and write the updated content +# (i.e. /usr/bin/bootc and systemd units) to a new derived container +# image. See the `Justfile` for an example +# +# Use e.g. --build-arg=base=quay.io/fedora/fedora-bootc:42 to target # Fedora instead. -ARG base=quay.io/centos-bootc/centos-bootc:stream9 +ARG base=quay.io/centos-bootc/centos-bootc:stream10 +# This first image captures a snapshot of the source code, +# note all the exclusions in .dockerignore. FROM scratch as src COPY . /src @@ -37,7 +41,7 @@ EORUN # This image installs build deps, pulls in our source code, and installs updated # bootc binaries in /out. The intention is that the target rootfs is extracted from /out -# back into a final stae (without the build deps etc) below. +# back into a final stage (without the build deps etc) below. FROM base as build # Flip this off to disable initramfs code ARG initramfs=1 diff --git a/Justfile b/Justfile index 4ea688ef3..63a404bf6 100644 --- a/Justfile +++ b/Justfile @@ -23,6 +23,40 @@ build-integration-test-image *ARGS: build-install-test-image: build-integration-test-image cd hack && podman build -t localhost/bootc-integration-install -f Containerfile.drop-lbis +build-disk-image container target: + #!/bin/bash + set -xeuo pipefail + SIZE=20G + bcvk=$(which bcvk 2>/dev/null || true) + if test -z "${bcvk}" && test "$(id -u)" != 0; then + echo "This task currently requires full root"; exit 1 + fi + # testcloud barfs on .raw + if test -n "${bcvk}"; then + bcvk to-disk --format=qcow2 --disk-size "${SIZE}" --filesystem ext4 {{container}} {{target}} + else + TMPDISK={{target}}.raw + truncate -s "${SIZE}" "${TMPDISK}" + podman run \ + --rm \ + --privileged \ + --pid=host \ + --security-opt label=type:unconfined_t \ + -v /var/lib/containers:/var/lib/containers \ + -v /dev:/dev \ + -v $(pwd)/target:/target \ + localhost/bootc-integration \ + bootc install to-disk \ + --filesystem "ext4" \ + --karg=console=ttyS0,115200n8 \ + --generic-image \ + --via-loopback \ + /target/$(basename ${TMPDISK}) + qemu-img convert -f raw -O qcow2 ${TMPDISK} {{target}} + rm -f "${TMPDISK}" + fi + + # These tests accept the container image as input, and may spawn it. run-container-external-tests: ./tests/container/run localhost/bootc diff --git a/crates/lib/src/bootc_composefs/boot.rs b/crates/lib/src/bootc_composefs/boot.rs index f604fe660..4dae7d5cb 100644 --- a/crates/lib/src/bootc_composefs/boot.rs +++ b/crates/lib/src/bootc_composefs/boot.rs @@ -550,6 +550,7 @@ pub(crate) fn setup_composefs_bls_boot( } /// Writes a PortableExecutable to ESP along with any PE specific or Global addons +#[context("Writing {file_path} to ESP")] fn write_pe_to_esp( repo: &ComposefsRepository, file: &RegularFile, @@ -569,7 +570,8 @@ fn write_pe_to_esp( if matches!(pe_type, PEType::Uki) { let cmdline = uki::get_cmdline(&efi_bin).context("Getting UKI cmdline")?; - let (composefs_cmdline, insecure) = get_cmdline_composefs::(cmdline)?; + let (composefs_cmdline, insecure) = + get_cmdline_composefs::(cmdline).context("Parsing composefs=")?; // If the UKI cmdline does not match what the user has passed as cmdline option // NOTE: This will only be checked for new installs and now upgrades/switches diff --git a/crates/tests-integration/src/system_reinstall.rs b/crates/tests-integration/src/system_reinstall.rs index 91e12fc2c..69699737f 100644 --- a/crates/tests-integration/src/system_reinstall.rs +++ b/crates/tests-integration/src/system_reinstall.rs @@ -151,11 +151,11 @@ pub(crate) fn run(image: &str, testargs: libtest_mimic::Arguments) -> Result<()> // Run system-reinstall-bootc let mut p: PtySession = rexpect::spawn( - "/usr/bin/system-reinstall-bootc quay.io/centos-bootc/centos-bootc:stream10", + "/usr/bin/system-reinstall-bootc quay.io/centos-bootc/centos-bootc:stream9", Some(600000), // Increase timeout for pulling the image )?; - p.exp_string("Image quay.io/centos-bootc/centos-bootc:stream10 is not present locally, pulling it now.")?; + p.exp_string("Image quay.io/centos-bootc/centos-bootc:stream9 is not present locally, pulling it now.")?; p.exp_regex("Found only one user ([^:]+) with ([\\d]+) SSH authorized keys.")?; p.exp_string("[Y/n]")?; p.send_line("y")?; diff --git a/tests/build.sh b/tests/build.sh index ae0d5cd13..cb13acbfe 100755 --- a/tests/build.sh +++ b/tests/build.sh @@ -6,12 +6,6 @@ set -exuo pipefail # If provided should be of the form fedora-42 or centos-10 target=${1:-} - -bcvk=$(which bcvk 2>/dev/null || true) -if test -z "${bcvk}" && test "$(id -u)" != 0; then - echo "This script currently requires full root"; exit 1 -fi - build_args=() if test -n "${target:-}"; then shift @@ -39,31 +33,4 @@ just build-integration-test-image # Host builds will have this already, but we use it as a general dumping space # for output artifacts mkdir -p target - -SIZE=10G -DISK=target/bootc-integration-test.qcow2 -rm -vf "${DISK}" -# testcloud barfs on .raw -if test -n "${bcvk}"; then - bcvk to-disk --format=qcow2 --disk-size "${SIZE}" --filesystem ext4 localhost/bootc-integration "${DISK}" -else - TMPDISK=target/bootc-integration-test.raw - truncate -s "${SIZE}" "${TMPDISK}" - podman run \ - --rm \ - --privileged \ - --pid=host \ - --security-opt label=type:unconfined_t \ - -v /var/lib/containers:/var/lib/containers \ - -v /dev:/dev \ - -v $(pwd)/target:/target \ - localhost/bootc-integration \ - bootc install to-disk \ - --filesystem "ext4" \ - --karg=console=ttyS0,115200n8 \ - --generic-image \ - --via-loopback \ - /target/$(basename ${TMPDISK}) - qemu-img convert -f raw -O qcow2 ${TMPDISK} ${DISK} - rm -f "${TMPDISK}" -fi +just build-disk-image localhost/bootc-integration target/bootc-integration-test.qcow2