Skip to content

Commit eb5177d

Browse files
committed
ci: run e2e tests against all active K8s versions
Retrieve the active k8s version and build a test matrix. Fixes: #48 Generated-by: AI Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 1631183 commit eb5177d

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ concurrency:
1717
cancel-in-progress: true
1818

1919
jobs:
20+
supported-versions:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
matrix: ${{ steps.set-matrix.outputs.matrix }}
24+
steps:
25+
- name: Get supported Kubernetes versions
26+
id: set-matrix
27+
run: |
28+
MATRIX=$(curl -s https://endoflife.date/api/kubernetes.json | \
29+
jq -c '[.[] | select(.eol > (now | strftime("%Y-%m-%d"))) | .cycle][:3]')
30+
echo "matrix=${MATRIX}" >> "$GITHUB_OUTPUT"
31+
2032
unit:
2133
runs-on: ubuntu-latest
2234
permissions:
@@ -85,13 +97,19 @@ jobs:
8597

8698
e2e:
8799
runs-on: ubuntu-latest
88-
needs: build-bink
100+
needs: [build-bink, supported-versions]
89101
timeout-minutes: 30
90102
permissions:
91103
contents: read
92104
packages: write
105+
strategy:
106+
# Run all versions even if one fails to identify version-specific issues.
107+
fail-fast: false
108+
matrix:
109+
kube-minor: ${{ fromJson(needs.supported-versions.outputs.matrix) }}
93110
env:
94111
IMAGE: ghcr.io/${{ github.repository }}
112+
BINK_NODE_DISK_IMAGE: ghcr.io/bootc-dev/bink/node:v${{ matrix.kube-minor }}-fedora-44-disk
95113
steps:
96114
- name: Checkout
97115
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -138,6 +156,10 @@ jobs:
138156
- name: Start podman socket
139157
run: systemctl --user start podman.socket
140158

159+
- name: Get default K8s version
160+
id: defaults
161+
run: echo "kube-minor=$(make -s print-var-DEFAULT_KUBE_MINOR)" >> "$GITHUB_OUTPUT"
162+
141163
- name: Build operator image
142164
run: make buildimg
143165

@@ -158,12 +180,12 @@ jobs:
158180
if: always()
159181
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
160182
with:
161-
name: e2e-logs
183+
name: e2e-logs-${{ matrix.kube-minor }}
162184
path: _output/logs/
163185
if-no-files-found: ignore
164186

165187
- name: Push to GHCR
166-
if: github.event_name == 'push'
188+
if: github.event_name == 'push' && matrix.kube-minor == steps.defaults.outputs.kube-minor
167189
env:
168190
ACTOR: ${{ github.actor }}
169191
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)