Skip to content

Commit e980dbf

Browse files
Johan-Liebert1cgwalters
authored andcommitted
ci/test: Pass bootloader as argument to Dockerfile
We want to install systemd boot and remove bootupd for systemd boot images. Pass in a `bootloader` argument to the build Dockerfile Signed-off-by: Pragyan Poudyal <pragyanpoudyal41999@gmail.com>
1 parent a402c45 commit e980dbf

4 files changed

Lines changed: 25 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,28 @@ jobs:
182182
run: |
183183
BASE=$(just pullspec-for-os base ${{ matrix.test_os }})
184184
echo "BOOTC_base=${BASE}" >> $GITHUB_ENV
185+
echo "RUST_BACKTRACE=full" >> $GITHUB_ENV
186+
echo "RUST_LOG=trace" >> $GITHUB_ENV
185187
186188
case "${{ matrix.variant }}" in
187-
composefs-grub|composefs-sdboot)
189+
composefs-grub)
188190
echo "BOOTC_variant=composefs" >> $GITHUB_ENV
191+
echo "BOOTC_bootloader=grub" >> $GITHUB_ENV
189192
;;
190193
191-
*)
194+
composefs-sdboot)
195+
echo "BOOTC_variant=composefs" >> $GITHUB_ENV
196+
echo "BOOTC_bootloader=systemd" >> $GITHUB_ENV
197+
;;
198+
199+
composefs-sealeduki-sdboot)
200+
echo "BOOTC_variant=${{ matrix.variant }}" >> $GITHUB_ENV
201+
echo "BOOTC_bootloader=systemd" >> $GITHUB_ENV
202+
;;
203+
204+
ostree)
192205
echo "BOOTC_variant=${{ matrix.variant }}" >> $GITHUB_ENV
206+
echo "BOOTC_bootloader=grub" >> $GITHUB_ENV
193207
;;
194208
esac
195209
@@ -208,7 +222,8 @@ jobs:
208222

209223
- name: Build container
210224
run: |
211-
BOOTC_SKIP_PACKAGE=1 just build
225+
BOOTC_SKIP_PACKAGE=1 just bootloader=$BOOTC_bootloader build
226+
212227
# Extra cross-check (duplicating the integration test) that we're using the right base
213228
used_vid=$(podman run --rm localhost/bootc bash -c '. /usr/lib/os-release && echo ${ID}-${VERSION_ID}')
214229
test ${{ matrix.test_os }} = "${used_vid}"

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,13 @@ RUN --network=none --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp
144144
# Perform all filesystem transformations except generating the sealed UKI (if configured)
145145
FROM base as base-penultimate
146146
ARG variant
147+
ARG bootloader
147148
# Switch to a signed systemd-boot, if configured
148149
RUN --network=none --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp \
149150
--mount=type=bind,from=packaging,src=/,target=/run/packaging \
150151
--mount=type=bind,from=sdboot-signed,src=/,target=/run/sdboot-signed <<EORUN
151152
set -xeuo pipefail
152-
if test "${variant}" = "composefs-sealeduki-sdboot"; then
153+
if [[ "${bootloader}" == "systemd" ]]; then
153154
/run/packaging/switch-to-sdboot /run/sdboot-signed
154155
fi
155156
EORUN

Justfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ upgrade_img := base_img + "-upgrade"
2020

2121
# Build variant: ostree (default) or composefs-sealeduki-sdboot (sealed UKI)
2222
variant := env("BOOTC_variant", "ostree")
23+
bootloader := env("BOOTC_bootloader", "grub")
2324
# Base container image to build from
2425
base := env("BOOTC_base", "quay.io/centos-bootc/centos-bootc:stream10")
2526
# Buildroot base image
@@ -38,7 +39,7 @@ lbi_images := "quay.io/curl/curl:latest quay.io/curl/curl-base:latest registry.a
3839
fedora-coreos := "quay.io/fedora/fedora-coreos:testing-devel"
3940
generic_buildargs := ""
4041
_extra_src_args := if extra_src != "" { "-v " + extra_src + ":/run/extra-src:ro --security-opt=label=disable" } else { "" }
41-
base_buildargs := generic_buildargs + " " + _extra_src_args + " --build-arg=base=" + base + " --build-arg=variant=" + variant
42+
base_buildargs := generic_buildargs + " " + _extra_src_args + " --build-arg=base=" + base + " --build-arg=variant=" + variant + " --build-arg=bootloader=" + bootloader
4243
buildargs := base_buildargs \
4344
+ " --cap-add=all --security-opt=label=type:container_runtime_t --device /dev/fuse" \
4445
+ " --secret=id=secureboot_key,src=target/test-secureboot/db.key --secret=id=secureboot_cert,src=target/test-secureboot/db.crt"
@@ -110,7 +111,8 @@ test-composefs-sealeduki-sdboot:
110111

111112
[group('core')]
112113
test-composefs bootloader:
113-
just variant=composefs test-tmt --composefs-backend --bootloader {{bootloader}} \
114+
just variant=composefs bootloader={{bootloader}} \
115+
test-tmt --composefs-backend --bootloader {{bootloader}} \
114116
readonly \
115117
bib-build \
116118
download-only \

tmt/tests/booted/test-image-pushpull-upgrade.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ RUN echo test content > /usr/share/blah.txt
5454
let v = podman run --rm localhost/bootc-derived cat /usr/share/blah.txt | str trim
5555
assert equal $v "test content"
5656

57-
mut orig_root_mtime = null;
57+
mut orig_root_mtime = 0;
5858

5959
if not $is_composefs {
6060
$orig_root_mtime = ls -Dl /ostree/bootc | get modified

0 commit comments

Comments
 (0)