Skip to content

Commit de3c29f

Browse files
committed
ci: Move disk wrapper into Justfile
So it can be executed more generically on any container image as input and write to output. Signed-off-by: Colin Walters <[email protected]>
1 parent 0b69f7d commit de3c29f

File tree

2 files changed

+35
-34
lines changed

2 files changed

+35
-34
lines changed

Justfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,40 @@ build-integration-test-image *ARGS:
2323
build-install-test-image: build-integration-test-image
2424
cd hack && podman build -t localhost/bootc-integration-install -f Containerfile.drop-lbis
2525

26+
build-disk-image container target:
27+
#!/bin/bash
28+
set -xeuo pipefail
29+
SIZE=20G
30+
bcvk=$(which bcvk 2>/dev/null || true)
31+
if test -z "${bcvk}" && test "$(id -u)" != 0; then
32+
echo "This task currently requires full root"; exit 1
33+
fi
34+
# testcloud barfs on .raw
35+
if test -n "${bcvk}"; then
36+
bcvk to-disk --format=qcow2 --disk-size "${SIZE}" --filesystem ext4 {{container}} {{target}}
37+
else
38+
TMPDISK={{target}}.raw
39+
truncate -s "${SIZE}" "${TMPDISK}"
40+
podman run \
41+
--rm \
42+
--privileged \
43+
--pid=host \
44+
--security-opt label=type:unconfined_t \
45+
-v /var/lib/containers:/var/lib/containers \
46+
-v /dev:/dev \
47+
-v $(pwd)/target:/target \
48+
localhost/bootc-integration \
49+
bootc install to-disk \
50+
--filesystem "ext4" \
51+
--karg=console=ttyS0,115200n8 \
52+
--generic-image \
53+
--via-loopback \
54+
/target/$(basename ${TMPDISK})
55+
qemu-img convert -f raw -O qcow2 ${TMPDISK} {{target}}
56+
rm -f "${TMPDISK}"
57+
fi
58+
59+
2660
# These tests accept the container image as input, and may spawn it.
2761
run-container-external-tests:
2862
./tests/container/run localhost/bootc

tests/build.sh

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ set -exuo pipefail
66

77
# If provided should be of the form fedora-42 or centos-10
88
target=${1:-}
9-
10-
bcvk=$(which bcvk 2>/dev/null || true)
11-
if test -z "${bcvk}" && test "$(id -u)" != 0; then
12-
echo "This script currently requires full root"; exit 1
13-
fi
14-
159
build_args=()
1610
if test -n "${target:-}"; then
1711
shift
@@ -39,31 +33,4 @@ just build-integration-test-image
3933
# Host builds will have this already, but we use it as a general dumping space
4034
# for output artifacts
4135
mkdir -p target
42-
43-
SIZE=10G
44-
DISK=target/bootc-integration-test.qcow2
45-
rm -vf "${DISK}"
46-
# testcloud barfs on .raw
47-
if test -n "${bcvk}"; then
48-
bcvk to-disk --format=qcow2 --disk-size "${SIZE}" --filesystem ext4 localhost/bootc-integration "${DISK}"
49-
else
50-
TMPDISK=target/bootc-integration-test.raw
51-
truncate -s "${SIZE}" "${TMPDISK}"
52-
podman run \
53-
--rm \
54-
--privileged \
55-
--pid=host \
56-
--security-opt label=type:unconfined_t \
57-
-v /var/lib/containers:/var/lib/containers \
58-
-v /dev:/dev \
59-
-v $(pwd)/target:/target \
60-
localhost/bootc-integration \
61-
bootc install to-disk \
62-
--filesystem "ext4" \
63-
--karg=console=ttyS0,115200n8 \
64-
--generic-image \
65-
--via-loopback \
66-
/target/$(basename ${TMPDISK})
67-
qemu-img convert -f raw -O qcow2 ${TMPDISK} ${DISK}
68-
rm -f "${TMPDISK}"
69-
fi
36+
just build-disk-image localhost/bootc-integration target/bootc-integration-test.qcow2

0 commit comments

Comments
 (0)