Skip to content

Commit 587c273

Browse files
committed
github: unify docker-tests and linux-ab
This consolidates docker-tests.yml and linux-ab.yml into a single config-tests.yml workflow that builds kdevops containers once and reuses them across all test jobs via GitHub Container Registry. The unified approach eliminates duplicate container builds while providing comprehensive validation across Debian, Fedora, and OpenSUSE distributions. The A/B testing script is modified to work in GitHub containers by generating only the configuration files needed for validation (extra_vars.yaml) instead of running the full make target that requires systemd services unavailable in GitHub-hosted runners (container environments). Generated-by: Claude AI Link: https://lore.kernel.org/r/20250926-ci-unify-github-hosted-runners-workflows-v1-1-582cad197315@samsung.com Signed-off-by: Daniel Gomez <[email protected]>
1 parent aa530c8 commit 587c273

File tree

4 files changed

+270
-107
lines changed

4 files changed

+270
-107
lines changed

.github/workflows/config-tests.yml

Lines changed: 258 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,258 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
---
3+
# Configuration validation tests that run in GitHub-hosted containers.
4+
# This workflow validates kdevops configuration generation and A/B testing
5+
# setup without requiring infrastructure provisioning, making it suitable
6+
# for GitHub-hosted runners with limited resources.
7+
name: Configuration Tests
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
- 'ci-testing/**'
14+
pull_request:
15+
branches:
16+
- main
17+
workflow_dispatch:
18+
19+
env:
20+
REGISTRY: ghcr.io
21+
IMAGE_NAME: ${{ github.repository }}/kdevops-ci
22+
23+
jobs:
24+
build-kdevops-containers:
25+
name: Build kdevops Container (${{ matrix.base_image_name }})
26+
runs-on: ubuntu-latest
27+
permissions:
28+
contents: read
29+
packages: write
30+
outputs:
31+
debian-image: ${{ steps.set-outputs-debian.outputs.debian-image }}
32+
fedora-image: ${{ steps.set-outputs-fedora.outputs.fedora-image }}
33+
opensuse-image: ${{ steps.set-outputs-opensuse.outputs.opensuse-image }}
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
include:
38+
- base_image: debian:testing
39+
base_image_name: debian
40+
install_cmd: >
41+
apt update && apt-get install -y
42+
ansible-core
43+
bash
44+
bison
45+
coreutils
46+
flex
47+
gawk
48+
gcc
49+
git
50+
hostname
51+
libvirt-clients
52+
libvirt0
53+
make
54+
ncurses-dev
55+
netcat-openbsd
56+
pkg-config
57+
python3
58+
sudo
59+
traceroute
60+
which
61+
- base_image: fedora:latest
62+
base_image_name: fedora
63+
install_cmd: >
64+
dnf install -y
65+
ansible
66+
bash
67+
bison
68+
coreutils
69+
flex
70+
gawk
71+
gcc
72+
git
73+
hostname
74+
libvirt-client
75+
make
76+
ncurses-devel
77+
nmap-ncat
78+
pkgconf
79+
python3
80+
sudo
81+
traceroute
82+
which
83+
- base_image: opensuse/tumbleweed
84+
base_image_name: opensuse
85+
install_cmd: >
86+
zypper refresh && zypper install -y
87+
ansible
88+
bash
89+
bison
90+
coreutils
91+
flex
92+
gawk
93+
gcc
94+
git
95+
hostname
96+
libvirt
97+
make
98+
ncurses-devel
99+
netcat-openbsd
100+
pkg-config
101+
python3
102+
sudo
103+
traceroute
104+
which
105+
steps:
106+
- name: Checkout repository
107+
uses: actions/checkout@v4
108+
109+
- name: Log in to Container Registry
110+
uses: docker/login-action@v3
111+
with:
112+
registry: ${{ env.REGISTRY }}
113+
username: ${{ github.actor }}
114+
password: ${{ secrets.GITHUB_TOKEN }}
115+
116+
- name: Create Dockerfile for ${{ matrix.base_image_name }}
117+
run: |
118+
cat > Dockerfile.${{ matrix.base_image_name }} << 'EOF'
119+
FROM ${{ matrix.base_image }}
120+
RUN ${{ matrix.install_cmd }}
121+
RUN git config --global --add safe.directory '*' && \
122+
git config --global user.name "kdevops-ci" && \
123+
git config --global user.email "[email protected]"
124+
RUN mkdir -p /github/home/.ssh && chmod 700 /github/home/.ssh
125+
ENV USER=kdevops-ci
126+
ENV HOME=/github/home
127+
WORKDIR /workspace
128+
EOF
129+
130+
- name: Build and test ${{ matrix.base_image_name }} container
131+
run: |
132+
IMAGE_TAG="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ matrix.base_image_name }}:${{ github.sha }}"
133+
134+
# Build container
135+
docker build -f Dockerfile.${{ matrix.base_image_name }} -t "$IMAGE_TAG" .
136+
137+
# Test basic functionality
138+
docker run --rm -v "$PWD:/workspace" "$IMAGE_TAG" sh -c "
139+
echo '🧪 Testing kdevops build in ${{ matrix.base_image_name }} container'
140+
make mrproper
141+
echo '✅ Basic kdevops build validation passed'
142+
"
143+
144+
# Push container
145+
docker push "$IMAGE_TAG"
146+
147+
- name: Set outputs for downstream jobs (debian only)
148+
id: set-outputs-debian
149+
if: matrix.base_image_name == 'debian'
150+
run: |
151+
./scripts/github_output.sh debian-image "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-debian:${{ github.sha }}"
152+
153+
- name: Set outputs for downstream jobs (fedora only)
154+
id: set-outputs-fedora
155+
if: matrix.base_image_name == 'fedora'
156+
run: |
157+
./scripts/github_output.sh fedora-image "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-fedora:${{ github.sha }}"
158+
159+
- name: Set outputs for downstream jobs (opensuse only)
160+
id: set-outputs-opensuse
161+
if: matrix.base_image_name == 'opensuse'
162+
run: |
163+
./scripts/github_output.sh opensuse-image "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-opensuse:${{ github.sha }}"
164+
165+
linux-ab-config-tests:
166+
name: Linux A/B Tests (${{ matrix.distro_name }})
167+
runs-on: ubuntu-latest
168+
needs: build-kdevops-containers
169+
strategy:
170+
fail-fast: false
171+
matrix:
172+
include:
173+
- distro_name: debian
174+
container_image: ${{ needs.build-kdevops-containers.outputs.debian-image }}
175+
- distro_name: fedora
176+
container_image: ${{ needs.build-kdevops-containers.outputs.fedora-image }}
177+
- distro_name: opensuse
178+
container_image: ${{ needs.build-kdevops-containers.outputs.opensuse-image }}
179+
container: ${{ matrix.container_image }}
180+
steps:
181+
- name: Checkout repository
182+
uses: actions/checkout@v4
183+
184+
- name: Run Linux A/B testing configuration validation
185+
run: |
186+
echo "🧪 Running comprehensive A/B configuration tests on ${{ matrix.distro_name }}..."
187+
echo "This validates all 3 build methods without requiring VMs"
188+
make check-linux-ab
189+
190+
- name: Validate A/B test results and generated files
191+
run: |
192+
echo "✅ All A/B configuration tests passed on ${{ matrix.distro_name }}!"
193+
echo "📋 Validated configurations:"
194+
echo " - Target build method A/B setup"
195+
echo " - 9P build method A/B setup"
196+
echo " - Builder method A/B setup"
197+
echo " - Kernel reference differentiation"
198+
echo " - Configuration file generation (.config, .extra_vars_auto.yaml, extra_vars.yaml)"
199+
echo " - Cross-distribution compatibility: ${{ matrix.distro_name }}"
200+
201+
quick-config-validation:
202+
name: Quick Config Tests (${{ matrix.defconfig }}) on ${{ matrix.distro_name }}
203+
runs-on: ubuntu-latest
204+
needs: build-kdevops-containers
205+
strategy:
206+
fail-fast: false
207+
matrix:
208+
defconfig: [blktests_nvme, xfs_reflink_4k, lbs-xfs, linux-ab-testing]
209+
distro_name: [debian, fedora, opensuse]
210+
include:
211+
- distro_name: debian
212+
container_image: ${{ needs.build-kdevops-containers.outputs.debian-image }}
213+
- distro_name: fedora
214+
container_image: ${{ needs.build-kdevops-containers.outputs.fedora-image }}
215+
- distro_name: opensuse
216+
container_image: ${{ needs.build-kdevops-containers.outputs.opensuse-image }}
217+
container: ${{ matrix.container_image }}
218+
steps:
219+
- name: Checkout repository
220+
uses: actions/checkout@v4
221+
222+
- name: Test defconfig-${{ matrix.defconfig }} configuration
223+
run: |
224+
echo "🔧 Testing defconfig-${{ matrix.defconfig }} configuration on ${{ matrix.distro_name }}..."
225+
make mrproper
226+
make defconfig-${{ matrix.defconfig }}
227+
echo "📁 Checking files after defconfig..."
228+
test -f .config || (echo "❌ .config not generated by defconfig" && exit 1)
229+
test -f .extra_vars_auto.yaml || (echo "❌ .extra_vars_auto.yaml not generated by defconfig" && exit 1)
230+
echo "✅ defconfig generated .config and .extra_vars_auto.yaml successfully"
231+
232+
- name: Generate configuration files (container-safe)
233+
run: |
234+
echo "🔨 Generating core configuration files without systemd services..."
235+
# Generate the essential files from DEFAULT_DEPS but skip LOCALHOST_SETUP_WORK (systemd)
236+
# This generates: .kdevops.depcheck, extra_vars.yaml, ansible.cfg, hosts
237+
make .kdevops.depcheck
238+
make extra_vars.yaml
239+
make $PWD/ansible.cfg
240+
make $PWD/hosts
241+
echo "✅ Core configuration files generated successfully"
242+
243+
- name: Verify all generated configuration files
244+
run: |
245+
echo "📁 Validating all generated configuration files..."
246+
test -f .config || (echo "❌ .config not found" && exit 1)
247+
test -f .extra_vars_auto.yaml || (echo "❌ .extra_vars_auto.yaml not found" && exit 1)
248+
test -f extra_vars.yaml || (echo "❌ extra_vars.yaml not generated by make" && exit 1)
249+
test -f .kdevops.depcheck || (echo "❌ .kdevops.depcheck not found" && exit 1)
250+
test -f ansible.cfg || (echo "❌ ansible.cfg not found" && exit 1)
251+
test -f hosts || (echo "❌ hosts not found" && exit 1)
252+
echo "✅ All required configuration files generated:"
253+
echo " - .config (kernel-style configuration)"
254+
echo " - .extra_vars_auto.yaml (auto-generated from defconfig)"
255+
echo " - extra_vars.yaml (final ansible variables from make)"
256+
echo " - .kdevops.depcheck (dependency verification)"
257+
echo " - ansible.cfg (ansible configuration)"
258+
echo " - hosts (inventory file)"

.github/workflows/docker-tests.yml

Lines changed: 0 additions & 55 deletions
This file was deleted.

.github/workflows/linux-ab.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

scripts/test-linux-ab.sh

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: copyleft-next-0.3.1
33
#
4-
# Test A/B configuration locally of all Linux AB configurations posisble.
4+
# Test A/B configuration locally of all Linux AB configurations possible.
55
# The goal is to verify your extra_vars.yaml ends up with different kernel
66
# target refs for A and B group hosts. It does so also by checking that
77
# ansible will use these. No real bringup or live test is done.
88
#
9+
# Note: Originally this script ran full 'make' for each build method, but
10+
# GitHub Actions containers lack systemd and infrastructure dependencies
11+
# that kdevops requires. Since we only need to verify configuration
12+
# generation (not infrastructure setup), we run 'make extra_vars.yaml'
13+
# which generates the ansible variables needed for A/B validation while
14+
# skipping systemd services and other GitHub-incompatible components.
15+
#
916
# Outputs TAP (Test Anything Protocol) format results
1017

1118
set -e
@@ -115,11 +122,11 @@ for method in $BUILD_METHODS; do
115122
continue
116123
fi
117124

118-
# Generate configuration
119-
if make >/dev/null 2>&1; then
120-
tap_result "ok" "$method: Generate configuration (make)"
125+
# Generate configuration (container-safe)
126+
if make extra_vars.yaml >/dev/null 2>&1; then
127+
tap_result "ok" "$method: Generate configuration (extra_vars.yaml)"
121128
else
122-
tap_result "not ok" "$method: Generate configuration (make)" "Failed to run make"
129+
tap_result "not ok" "$method: Generate configuration (extra_vars.yaml)" "Failed to generate extra_vars.yaml"
123130
continue
124131
fi
125132

0 commit comments

Comments
 (0)