Skip to content

Commit 7eab41e

Browse files
committed
ci: Unify more of hack/ and tests/
A key thing for me is that the `Justfile` should be a one-stop shop for development of the project. It can't have everything but it should answer the basic questions of "how do I build and test this project". This aligns the recently added tmt-on-GHA flow a *bit* more closely with some of that. Biggest is to use the `just build-integration-test-image` as the canonical way to build a container image with our testing stuff in it; which uses our main Dockerfile Other cleanups: - Change test script to move into tests/tmt/ as a workaround for teemtee/tmt#3037 (comment) - Change the qemu logic to use SMBIOS credentials so we don't have to carry around both a disk image and a SSH key - Change qemu to use `-snapshot` so we can reuse disks - Change the scripts to accept data via argv[1] and not environment - Drop the hardcoded testing directory and use `target/` as a generic build artifact dir Signed-off-by: Colin Walters <[email protected]>
1 parent f4dfd81 commit 7eab41e

File tree

14 files changed

+184
-248
lines changed

14 files changed

+184
-248
lines changed

.github/workflows/integration.yml

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
name: bootc integration test
22
on:
33
pull_request:
4-
branches: [main]
4+
branches: [main]
5+
workflow_dispatch:
56

67
jobs:
78
build:
89
strategy:
910
matrix:
10-
test_os: [fedora-41, fedora-42, fedora-43, centos-9]
11-
test_runner: [ubuntu-latest, ubuntu-24.04-arm]
11+
#test_os: [fedora-42, fedora-43, centos-9, centos-10]
12+
test_os: [centos-10]
13+
test_runner: [ubuntu-24.04, ubuntu-24.04-arm]
1214

1315
runs-on: ${{ matrix.test_runner }}
1416

@@ -18,67 +20,56 @@ jobs:
1820
set -eux
1921
echo 'deb [trusted=yes] https://ftp.debian.org/debian/ testing main' | sudo tee /etc/apt/sources.list.d/testing.list
2022
sudo apt update
21-
sudo apt install -y crun/testing podman/testing
23+
sudo apt install -y crun/testing podman/testing just
2224
2325
- uses: actions/checkout@v4
2426

25-
- name: Build bootc and bootc image
26-
env:
27-
TEST_OS: ${{ matrix.test_os }}
28-
run: sudo -E TEST_OS=$TEST_OS tests/build.sh
27+
- name: Set architecture variable
28+
id: set_arch
29+
run: echo "ARCH=$(arch)" >> $GITHUB_ENV
2930

30-
- name: Grant sudo user permission to archive files
31+
- name: Build bootc and bootc image
3132
run: |
32-
sudo chmod 0755 /tmp/tmp-bootc-build/id_rsa
33+
sudo tests/build.sh ${{ matrix.test_os }}
3334
3435
- name: Archive bootc disk image - disk.raw
35-
if: matrix.test_runner == 'ubuntu-latest'
36-
uses: actions/upload-artifact@v4
37-
with:
38-
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-disk
39-
path: /tmp/tmp-bootc-build/disk.raw
40-
retention-days: 1
41-
42-
- name: Archive SSH private key - id_rsa
43-
if: matrix.test_runner == 'ubuntu-latest'
4436
uses: actions/upload-artifact@v4
4537
with:
46-
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-id_rsa
47-
path: /tmp/tmp-bootc-build/id_rsa
38+
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk
39+
path: target/disk.raw
4840
retention-days: 1
4941

5042
test:
5143
needs: build
5244
strategy:
5345
matrix:
54-
test_os: [fedora-41, fedora-42, fedora-43, centos-9]
46+
#test_os: [fedora-42, fedora-43, centos-9, centos-10]
47+
test_os: [centos-10]
5548
tmt_plan: [test-01-readonly, test-20-local-upgrade, test-21-logically-bound-switch, test-22-logically-bound-install, test-23-install-outside-container, test-24-local-upgrade-reboot]
5649

5750
runs-on: ubuntu-latest
5851

5952
steps:
6053
- uses: actions/checkout@v4
6154

62-
- name: Install dependence
55+
- name: Set architecture variable
56+
id: set_arch
57+
run: echo "ARCH=$(arch)" >> $GITHUB_ENV
58+
59+
- name: Install deps
6360
run: |
6461
sudo apt-get update
65-
sudo apt install -y qemu-kvm qemu-system
62+
sudo apt install -y qemu-kvm qemu-system just
6663
pip install --user tmt
6764
6865
- name: Create folder to save disk image
69-
run: mkdir -p /tmp/tmp-bootc-build
66+
run: mkdir -p target
7067

7168
- name: Download disk.raw
7269
uses: actions/download-artifact@v4
7370
with:
74-
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-disk
75-
path: /tmp/tmp-bootc-build
76-
77-
- name: Download id_rsa
78-
uses: actions/download-artifact@v4
79-
with:
80-
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-id_rsa
81-
path: /tmp/tmp-bootc-build
71+
name: PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-disk
72+
path: target
8273

8374
- name: Enable KVM group perms
8475
run: |
@@ -88,13 +79,13 @@ jobs:
8879
ls -l /dev/kvm
8980
9081
- name: Run test
91-
env:
92-
TMT_PLAN_NAME: ${{ matrix.tmt_plan }}
93-
run: chmod 600 /tmp/tmp-bootc-build/id_rsa && tests/test.sh
82+
run: |
83+
ls -al target
84+
tests/test.sh ${{ matrix.tmt_plan }}
9485
9586
- name: Archive TMT logs
9687
if: always()
9788
uses: actions/upload-artifact@v4
9889
with:
99-
name: tmt-log-PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ matrix.tmt_plan }}
90+
name: tmt-log-PR-${{ github.event.number }}-${{ matrix.test_os }}-${{ env.ARCH }}-${{ matrix.tmt_plan }}
10091
path: /var/tmp/tmt

.packit.yaml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,26 @@ jobs:
5959
owner: rhcontainerbot
6060
project: bootc
6161
enable_net: true
62+
# TODO
6263
notifications:
6364
failure_comment:
6465
message: "bootc Copr build failed for {commit_sha}. @admin check logs {logs_url} and packit dashboard {packit_dashboard_url}"
6566

66-
- job: tests
67-
trigger: pull_request
68-
targets:
69-
- centos-stream-9-x86_64
70-
- centos-stream-9-aarch64
71-
- centos-stream-10-x86_64
72-
- centos-stream-10-aarch64
73-
- fedora-42-x86_64
74-
- fedora-42-aarch64
75-
- fedora-rawhide-x86_64
76-
- fedora-rawhide-aarch64
77-
tmt_plan: /integration
78-
skip_build: true
79-
identifier: integration-test
67+
# TODO: Readd some tmt tests that install the built RPM and e.g. test out system-reinstall-bootc
68+
# - job: tests
69+
# trigger: pull_request
70+
# targets:
71+
# - centos-stream-9-x86_64
72+
# - centos-stream-9-aarch64
73+
# - centos-stream-10-x86_64
74+
# - centos-stream-10-aarch64
75+
# - fedora-42-x86_64
76+
# - fedora-42-aarch64
77+
# - fedora-rawhide-x86_64
78+
# - fedora-rawhide-aarch64
79+
# tmt_plan: /integration
80+
# skip_build: true
81+
# identifier: integration-test
8082

8183
- job: propose_downstream
8284
trigger: release

Justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ build *ARGS:
55
# This container image has additional testing content and utilities
66
build-integration-test-image *ARGS: build
77
podman build --jobs=4 -t localhost/bootc-integration -f hack/Containerfile {{ARGS}} .
8+
# Keep these in sync with what's used in hack/lbi
9+
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl:latest
10+
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl-base:latest
11+
podman pull --retry 5 --retry-delay 5s registry.access.redhat.com/ubi9/podman:latest
812

913
# Run container integration tests
1014
run-container-integration: build-integration-test-image

hack/Containerfile

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# This injects some extra testing stuff into our image
1+
# Build a container image that has extra testing stuff in it, such
2+
# as nushell, some preset logically bound images, etc. This expects
3+
# to create an image derived FROM localhost/bootc which was created
4+
# by the Dockerfile at top.
25

36
FROM scratch as context
47
# We only need this stuff in the initial context
@@ -11,7 +14,15 @@ ARG variant=
1114
# And this layer has additional stuff for testing, such as nushell etc.
1215
RUN --mount=type=bind,from=context,target=/run/context <<EORUN
1316
set -xeuo pipefail
14-
/run/context/hack/provision-derived.sh "$variant"
17+
cd /run/context/hack
18+
./provision-derived.sh "$variant"
19+
20+
# For test-22-logically-bound-install
21+
cp -a lbi/usr/. /usr
22+
for x in curl.container curl-base.image podman.image; do
23+
ln -s /usr/share/containers/systemd/$x /usr/lib/bootc/bound-images.d/$x
24+
done
25+
1526
# Add some testing kargs into our dev builds
1627
install -D -t /usr/lib/bootc/kargs.d /run/context/hack/test-kargs/*
1728
# Also copy in some default install configs we use for testing
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Image]
2+
Image=quay.io/curl/curl-base:latest
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[Container]
2+
Image=quay.io/curl/curl:latest
3+
GlobalArgs=--storage-opt=additionalimagestore=/usr/lib/bootc/storage
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This is not symlinked to bound-images.d so it should not be pulled.
2+
# It's here to represent an app image that exists
3+
# in a bootc image but is not logically bound.
4+
[Image]
5+
Image=registry.redhat.io/jboss-webserver-5/jws5-rhel8-operator:latest
6+
AuthFile=/root/auth.json
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[Image]
2+
Image=registry.access.redhat.com/ubi9/podman:latest

hack/packages.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Needed by tmt
2+
rsync
3+
/usr/bin/flock
4+
/usr/bin/awk

hack/provision-derived.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ case "${ID}-${VERSION_ID}" in
1616
dnf config-manager --set-enabled crb
1717
dnf -y install epel-release epel-next-release
1818
dnf -y install nu
19-
dnf clean all
2019
;;
2120
"rhel-9."*)
2221
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
2322
dnf -y install nu
24-
dnf clean all
2523
;;
2624
"centos-10"|"rhel-10."*)
2725
# nu is not available in CS10
@@ -32,10 +30,13 @@ case "${ID}-${VERSION_ID}" in
3230
;;
3331
"fedora-"*)
3432
dnf -y install nu
35-
dnf clean all
3633
;;
3734
esac
3835

36+
# Extra packages we install
37+
grep -Ev -e '^#' packages.txt | xargs dnf -y install
38+
dnf clean all
39+
3940
# Stock extra cleaning of logs and caches in general (mostly dnf)
4041
rm /var/log/* /var/cache /var/lib/{dnf,rpm-state,rhsm} -rf
4142
# And clean root's homedir

0 commit comments

Comments
 (0)