Skip to content

Commit 9e91e79

Browse files
anoopcs9phlogistonjohn
authored andcommitted
workflows: Dynamically detect fedora versions for test matrix
Instead of updating the versions during each fedora release we could automatically filter out the recent versions from publically available json data for fedora releases. In addition to that we rename fedora test jobs to symbolically represent the supported releases of fedora. This is done in an attempt to reduce the need for updating mergify configuration during each fedora release. Signed-off-by: Anoop C S <[email protected]>
1 parent 00ccd27 commit 9e91e79

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ on:
1010
- cron: 1 1 * * *
1111

1212
jobs:
13+
fedora-versions:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- id: fedora-versions
17+
run: |
18+
curl -s -L https://fedoraproject.org/releases.json -o fedora-releases.json
19+
LATEST=$(jq -r '[.[]|select(.variant == "Container" and .subvariant == "Container_Base" and .arch == "x86_64")][0]|.version' fedora-releases.json)
20+
PREVIOUS=$((LATEST - 1))
21+
22+
echo "latest=$LATEST" >> $GITHUB_OUTPUT
23+
echo "previous=$PREVIOUS" >> $GITHUB_OUTPUT
24+
outputs:
25+
latest: ${{ steps.fedora-versions.outputs.latest }}
26+
previous: ${{ steps.fedora-versions.outputs.previous }}
1327
check-commits:
1428
runs-on: ubuntu-latest
1529
if: github.event_name == 'pull_request'
@@ -24,16 +38,17 @@ jobs:
2438
- name: Run gitlint
2539
run: tox -e gitlint
2640
test:
41+
needs: fedora-versions
2742
runs-on: ubuntu-latest
2843
strategy:
2944
fail-fast: false
3045
matrix:
31-
test_distro: ["fedora-40", "fedora-41", "centos-stream9"]
46+
test_distro: ["fedora-previous", "fedora-latest", "centos-stream9"]
3247
include:
33-
- test_distro: "fedora-40"
34-
base_image: "registry.fedoraproject.org/fedora:40"
35-
- test_distro: "fedora-41"
36-
base_image: "registry.fedoraproject.org/fedora:41"
48+
- test_distro: "fedora-previous"
49+
base_image: "registry.fedoraproject.org/fedora:${{ needs.fedora-versions.outputs.previous }}"
50+
- test_distro: "fedora-latest"
51+
base_image: "registry.fedoraproject.org/fedora:${{ needs.fedora-versions.outputs.latest }}"
3752
- test_distro: "centos-stream9"
3853
base_image: "quay.io/centos/centos:stream9"
3954
steps:

0 commit comments

Comments
 (0)