Skip to content

Commit 200a3e8

Browse files
committed
infra: switch from using templating to using reusable matrix
This will enable us to get rid of the custom jinja rendering and the workflow duplication with the templates.
1 parent ef49bb4 commit 200a3e8

11 files changed

+82
-358
lines changed

.branch-variables.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,3 @@ distro_release: "rawhide" # "rawhide" or a number without quotation marks
1111

1212
# The following only applies for rawhide.
1313
rawhide_fedora_version: 41 # number without quotation marks, or nothing if CI should not run for branched Fedora
14-
15-
# List of all the branches which are currently supported and CI should be executed on these.
16-
supported_branches:
17-
- fedora-40:
18-
variant: "fedora"
19-
- rhel-9:
20-
variant: "rhel"
21-
- rhel-10:
22-
variant: "rhel"

.github/workflows/container-autoupdate-fedora.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ permissions:
1616
contents: read
1717

1818
jobs:
19+
matrix-builder:
20+
uses: ./.github/workflows/matrix-builder.yml
1921

20-
master:
22+
container-rebuild-matrix:
2123
# Don't run scheduled workflows on forks.
2224
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
25+
needs: matrix-builder
2326
uses: ./.github/workflows/container-rebuild-action.yml
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
31+
exclude:
32+
- variant: "rhel"
2433
secrets: inherit
2534
with:
26-
container-tag: master
27-
branch: master
28-
29-
fedora-40:
30-
uses: ./.github/workflows/container-rebuild-action.yml
31-
secrets: inherit
32-
with:
33-
container-tag: fedora-40
34-
branch: fedora-40
35+
container-tag: ${{ matrix.branch }}
36+
branch: ${{ matrix.branch }}

.github/workflows/container-autoupdate-fedora.yml.j2

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

.github/workflows/l10n-po-update.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,23 @@ on:
1414
workflow_dispatch:
1515

1616
jobs:
17+
matrix-builder:
18+
uses: ./.github/workflows/matrix-builder.yml
19+
1720
update:
1821
runs-on: ubuntu-latest
1922
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
2023
environment: releases
2124
permissions:
2225
contents: write
2326
pull-requests: write
27+
strategy:
28+
needs: matrix-builder
2429
strategy:
2530
fail-fast: false
2631
max-parallel: 1
2732
matrix:
28-
branch: ['master', 'fedora-40', 'rhel-9', 'rhel-10']
33+
include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
2934

3035
steps:
3136
- name: Set up dependencies

.github/workflows/l10n-po-update.yml.j2

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

.github/workflows/matrix-builder.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Matrix builder
2+
on:
3+
workflow_call:
4+
# Map the workflow outputs to job outputs
5+
outputs:
6+
matrix:
7+
description: "Matrix of configurations"
8+
value: ${{ jobs.matrix-builder.outputs.matrix }}
9+
10+
jobs:
11+
matrix-builder:
12+
runs-on: ubuntu-20.04
13+
outputs:
14+
matrix: ${{ steps.convert.outputs.matrix }}
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Assign the matrix from .supported-branches.json
18+
id: convert
19+
run: |
20+
echo "matrix=$(yq -P -o=json .supported-branches.json | jq -c .)" >> $GITHUB_OUTPUT

.github/workflows/tests-daily.yml

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
# ======================================
2-
# WARNING!
3-
# THIS FILE IS GENERATED FROM A TEMPLATE
4-
# DO NOT EDIT THIS FILE MANUALLY!
5-
# ======================================
6-
# The template is located in: tests-daily.yml.j2
7-
81
# Run unit tests daily.
92
#
103
# This is different from container rebuilds, where the tests "gate" the new version. The last
@@ -34,38 +27,31 @@ permissions:
3427
contents: read
3528

3629
jobs:
30+
matrix-builder:
31+
uses: ./.github/workflows/matrix-builder.yml
32+
3733
unit-tests:
3834
runs-on: ubuntu-20.04
3935
timeout-minutes: 30
4036
# Don't run scheduled workflows on forks.
4137
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
38+
needs: matrix-builder
4239
strategy:
4340
fail-fast: false
4441
matrix:
45-
release: ['master', 'fedora-40']
46-
include:
47-
- release: 'master'
48-
target_branch: 'master'
49-
ci_tag: 'master'
50-
## add to release: [...] also eln if re-enabled by uncommenting the below
51-
#- release: 'eln'
52-
# target_branch: 'master'
53-
# ci_tag: 'eln'
54-
# build-args: '--build-arg=image=quay.io/fedoraci/fedora:eln-x86_64'
55-
- release: 'fedora-40'
56-
target_branch: 'fedora-40'
57-
ci_tag: 'fedora-40'
58-
42+
include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
43+
exclude:
44+
- variant: "rhel"
5945
env:
60-
CI_TAG: '${{ matrix.ci_tag }}'
46+
CI_TAG: '${{ matrix.branch }}'
6147
# Always avoid using cache because cache is not correctly invalidated.
6248
CONTAINER_BUILD_ARGS: '--no-cache ${{ matrix.build-args }}'
6349

6450
steps:
6551
- name: Clone repository
6652
uses: actions/checkout@v4
6753
with:
68-
ref: ${{ matrix.target_branch }}
54+
ref: ${{ matrix.branch }}
6955

7056
- name: Run tests in anaconda-ci container
7157
run: |
@@ -76,36 +62,31 @@ jobs:
7662
if: always()
7763
uses: actions/upload-artifact@v4
7864
with:
79-
name: 'logs (${{ matrix.ci_tag }})'
65+
name: 'logs (${{ matrix.branch }})'
8066
path: test-logs/*
8167

8268
rpm-tests:
8369
runs-on: ubuntu-20.04
8470
timeout-minutes: 30
8571
# Don't run scheduled workflows on forks.
8672
if: github.event_name != 'schedule' || github.repository == 'rhinstaller/anaconda'
73+
needs: matrix-builder
8774
strategy:
8875
fail-fast: false
8976
matrix:
90-
release: ['master', 'fedora-40']
91-
include:
92-
- release: 'master'
93-
target_branch: 'master'
94-
ci_tag: 'master'
95-
- release: 'fedora-40'
96-
target_branch: 'fedora-40'
97-
ci_tag: 'fedora-40'
98-
77+
include: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
78+
exclude:
79+
- variant: "rhel"
9980
env:
100-
CI_TAG: '${{ matrix.ci_tag }}'
81+
CI_TAG: '${{ matrix.branch }}'
10182
# Always avoid using cache because cache is not correctly invalidated.
10283
CONTAINER_BUILD_ARGS: '--no-cache ${{ matrix.build-args }}'
10384

10485
steps:
10586
- name: Clone repository
10687
uses: actions/checkout@v4
10788
with:
108-
ref: ${{ matrix.target_branch }}
89+
ref: ${{ matrix.branch }}
10990

11091
- name: Run RPM tests in container
11192
run: make -f Makefile.am container-rpm-test
@@ -114,5 +95,5 @@ jobs:
11495
if: always()
11596
uses: actions/upload-artifact@v4
11697
with:
117-
name: 'logs-rpm-test (${{ matrix.ci_tag }})'
98+
name: 'logs-rpm-test (${{ matrix.branch }})'
11899
path: test-logs/*

0 commit comments

Comments
 (0)