Skip to content

Commit 7e52650

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 58876bf commit 7e52650

File tree

4 files changed

+25
-36
lines changed

4 files changed

+25
-36
lines changed

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,20 @@ 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+
export BCVK_VERSION=0.5.3
70+
sudo apt install -y libkrb5-dev pkg-config libvirt-dev genisoimage qemu-utils qemu-kvm virtiofsd libvirt-daemon-system
71+
# Something in the stack is overriding this, but we want session right now for bcvk
72+
echo LIBVIRT_DEFAULT_URI=qemu:///session >> $GITHUB_ENV
73+
td=$(mktemp -d)
74+
cd $td
75+
# Install bcvk
76+
target=bcvk-$(arch)-unknown-linux-gnu
77+
curl -LO https://github.com/bootc-dev/bcvk/releases/download/v${BCVK_VERSION}/${target}.tar.gz
78+
tar xzf ${target}.tar.gz
79+
sudo install -T ${target} /usr/bin/bcvk
80+
cd -
81+
rm -rf "$td"
82+
83+
# Also bump the default fd limit as a workaround for https://github.com/bootc-dev/bcvk/issues/65
84+
sudo sed -i -e 's,^\* hard nofile 65536,* hard nofile 524288,' /etc/security/limits.conf

.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:

tests/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ just build-integration-test-image
3333
# Host builds will have this already, but we use it as a general dumping space
3434
# for output artifacts
3535
mkdir -p target
36+
# Debugging for https://github.com/bootc-dev/bcvk/issues/65
37+
echo ulimit=$(ulimit -Hn)
3638
just build-disk-image localhost/bootc-integration target/bootc-integration-test.qcow2

0 commit comments

Comments
 (0)