Skip to content

Commit cc93f32

Browse files
committed
ci: Use bcvk
Make builds unprivileged by default and start using bcvk in our own CI, the same way we expect people to do so locally now. Signed-off-by: Colin Walters <[email protected]>
1 parent 563b7a0 commit cc93f32

File tree

3 files changed

+20
-36
lines changed

3 files changed

+20
-36
lines changed

.github/actions/bootc-ubuntu-setup/action.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,17 @@ runs:
6565
if: ${{ inputs.libvirt == 'true' }}
6666
shell: bash
6767
run: |
68-
set -eux
69-
sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm qemu-utils libvirt-daemon-system
68+
set -xeuo pipefail
69+
sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm virtiofsd libvirt-daemon-system
70+
# Something in the stack is overriding this, but we want session right now for bcvk
71+
echo LIBVIRT_DEFAULT_URI=qemu:///session >> $GITHUB_ENV
72+
td=$(mktemp -d)
73+
cd $td
74+
# Install bcvk
75+
curl -LO https://github.com/bootc-dev/bcvk/releases/download/v0.5.1/bcvk-x86_64-unknown-linux-gnu.tar.gz
76+
echo '1c9bb9e2b1e39d64c93b847350dd028832da27e7f7b0296b14ebfc2fb66b5c2c bcvk-x86_64-unknown-linux-gnu.tar.gz' > sums
77+
sha256sum -c sums
78+
tar zxvf bcvk*.tar.gz
79+
sudo install -T bcvk-$(arch)-*linux-gnu /usr/bin/bcvk
80+
cd -
81+
rm -rf "$td"

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ on:
1919

2020
env:
2121
CARGO_TERM_COLOR: always
22+
# Something seems to be setting this in the default GHA runners, which breaks bcvk
23+
# as the default runner user doesn't have access
24+
LIBVIRT_DEFAULT_URI: "qemu:///session"
2225

2326
concurrency:
2427
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
@@ -135,11 +138,11 @@ jobs:
135138

136139
- name: Build container and disk image
137140
run: |
138-
sudo tests/build.sh ${{ matrix.test_os }}
141+
tests/build.sh ${{ matrix.test_os }}
139142
140143
- name: Run container tests
141144
run:
142-
sudo just test-container
145+
just test-container
143146

144147
- name: Archive disk image
145148
uses: actions/upload-artifact@v4

Justfile

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -24,38 +24,7 @@ build-install-test-image: build-integration-test-image
2424
cd hack && podman build -t localhost/bootc-integration-install -f Containerfile.drop-lbis
2525

2626
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-
27+
bcvk to-disk --format=qcow2 --disk-size 20G --filesystem ext4 {{container}} {{target}}
5928

6029
# These tests accept the container image as input, and may spawn it.
6130
run-container-external-tests:

0 commit comments

Comments
 (0)