Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .packit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion crates/lib/src/bootc_composefs/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Sha256HashValue>,
file: &RegularFile<Sha256HashValue>,
Expand All @@ -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::<Sha256HashValue>(cmdline)?;
let (composefs_cmdline, insecure) =
get_cmdline_composefs::<Sha256HashValue>(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
Expand Down
4 changes: 2 additions & 2 deletions crates/tests-integration/src/system_reinstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?;
Expand Down
35 changes: 1 addition & 34 deletions tests/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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