Skip to content

Commit 2764d26

Browse files
committed
ci: Add container integration test for rpm and bootc
Generalize qemu-kvm-integration-tests.yml to run some "container-*" environments as well. For "classic rpm" OSes that does not give us too much beyond making sure that the container tests actually work (developers might use them locally, after all). 90% of the logic (setup, compatibility check, status updates, etc.) is the same, so it's not economic to duplicate all of that into a new workflow. Add Fedora/CentOS *-bootc scenarios: These check that our role works during a bootc container build, without any systemd, processes, or other runtime environment. tox-lsr added support for this in linux-system-roles/tox-lsr#188. However, as most roles don't currently work in that environment, introduce and check a new `containerbuild` tag in meta/main.yml. We'll add this to roles as we adjust them. Similarly, as not every role works in a running container (e.g. due to assuming SELinux), check a new `container` tag in their tests. See https://issues.redhat.com/browse/RHEL-85652
1 parent 21d8d60 commit 2764d26

File tree

1 file changed

+58
-10
lines changed

1 file changed

+58
-10
lines changed

.github/workflows/qemu-kvm-integration-tests.yml

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: QEMU/KVM Integration tests
2+
name: Test
33
on: # yamllint disable-line rule:truthy
44
pull_request:
55
merge_group:
@@ -17,18 +17,34 @@ permissions:
1717
# This is required for the ability to create/update the Pull request status
1818
statuses: write
1919
jobs:
20-
qemu_kvm:
20+
scenario:
2121
runs-on: ubuntu-latest
2222

2323
strategy:
2424
fail-fast: false
2525
matrix:
2626
scenario:
27+
# QEMU
2728
- { image: "centos-9", env: "qemu-ansible-core-2.16" }
2829
- { image: "centos-10", env: "qemu-ansible-core-2.17" }
2930
# ansible/libdnf5 bug: https://issues.redhat.com/browse/RHELMISC-10110
3031
# - { image: "fedora-41", env: "qemu-ansible-core-2.17" }
3132
- { image: "fedora-42", env: "qemu-ansible-core-2.17" }
33+
34+
# container
35+
- { image: "centos-9", env: "container-ansible-core-2.16" }
36+
- { image: "centos-9-bootc", env: "container-ansible-core-2.16" }
37+
# broken on non-running dbus
38+
# - { image: "centos-10", env: "container-ansible-core-2.17" }
39+
- { image: "centos-10-bootc", env: "container-ansible-core-2.17" }
40+
- { image: "fedora-41", env: "container-ansible-core-2.17" }
41+
- { image: "fedora-42", env: "container-ansible-core-2.17" }
42+
- { image: "fedora-41-bootc", env: "container-ansible-core-2.17" }
43+
- { image: "fedora-42-bootc", env: "container-ansible-core-2.17" }
44+
45+
env:
46+
TOX_ARGS: "--skip-tags tests::infiniband,tests::nvme,tests::scsi"
47+
3248
steps:
3349
- name: Checkout repo
3450
uses: actions/checkout@v4
@@ -38,6 +54,7 @@ jobs:
3854
run: |
3955
set -euxo pipefail
4056
image="${{ matrix.scenario.image }}"
57+
image="${image%-bootc}"
4158
4259
# convert image to tag formats
4360
platform=
@@ -51,6 +68,20 @@ jobs:
5168
supported=true
5269
fi
5370
71+
# bootc build support (in buildah) has a separate flag
72+
if [ "${{ matrix.scenario.image }}" != "$image" ]; then
73+
if ! yq -e '.galaxy_info.galaxy_tags[] | select(. == "containerbuild")' meta/main.yml; then
74+
supported=
75+
fi
76+
else
77+
# roles need to opt into support for running in a system container
78+
env="${{ matrix.scenario.env }}"
79+
if [ "${env#container}" != "$env" ] &&
80+
! yq -e '.galaxy_info.galaxy_tags[] | select(. == "container")' meta/main.yml; then
81+
supported=
82+
fi
83+
fi
84+
5485
echo "supported=$supported" >> "$GITHUB_OUTPUT"
5586
5687
- name: Set up /dev/kvm
@@ -82,14 +113,13 @@ jobs:
82113
curl -o ~/.config/linux-system-roles.json
83114
https://raw.githubusercontent.com/linux-system-roles/linux-system-roles.github.io/master/download/linux-system-roles.json
84115
85-
- name: Run qemu/kvm tox integration tests
86-
if: steps.check_platform.outputs.supported
87-
run: >-
88-
tox -e ${{ matrix.scenario.env }} -- --image-name ${{ matrix.scenario.image }} --make-batch
89-
--log-level=debug --skip-tags tests::infiniband,tests::nvme,tests::scsi --
116+
- name: Run qemu integration tests
117+
if: steps.check_platform.outputs.supported && startsWith(matrix.scenario.env, 'qemu')
118+
run: |
119+
tox -e ${{ matrix.scenario.env }} -- --image-name ${{ matrix.scenario.image }} --make-batch $TOX_ARGS --
90120
91-
- name: Test result summary
92-
if: steps.check_platform.outputs.supported && always()
121+
- name: Qemu result summary
122+
if: steps.check_platform.outputs.supported && startsWith(matrix.scenario.env, 'qemu') && always()
93123
run: |
94124
set -euo pipefail
95125
# some platforms may have setup/cleanup playbooks - need to find the
@@ -109,6 +139,24 @@ jobs:
109139
echo "$f"
110140
done < batch.report
111141
142+
- name: Run container tox integration tests
143+
if: steps.check_platform.outputs.supported && startsWith(matrix.scenario.env, 'container')
144+
run: |
145+
set -euo pipefail
146+
# HACK: debug.py/profile.py setup is broken
147+
export LSR_CONTAINER_PROFILE=false
148+
export LSR_CONTAINER_PRETTY=false
149+
rc=0
150+
for t in tests/tests_*.yml; do
151+
if tox -e ${{ matrix.scenario.env }} -- --image-name ${{ matrix.scenario.image }} $t > ${t}.log 2>&1; then
152+
echo "PASS: $(basename $t)"
153+
else
154+
echo "FAIL: $(basename $t)"
155+
rc=1
156+
fi
157+
done
158+
exit $rc
159+
112160
- name: Upload test logs on failure
113161
if: failure()
114162
uses: actions/upload-artifact@v4
@@ -139,6 +187,6 @@ jobs:
139187
uses: myrotvorets/set-commit-status-action@master
140188
with:
141189
status: success
142-
context: "${{ github.workflow }} / qemu_kvm (${{ matrix.scenario.image }}, ${{ matrix.scenario.env }}) (pull_request)"
190+
context: "${{ github.workflow }} / scenario (${{ matrix.scenario.image }}, ${{ matrix.scenario.env }}) (pull_request)"
143191
description: The role does not support this platform. Skipping.
144192
targetUrl: ""

0 commit comments

Comments
 (0)