Skip to content

Commit 4ec11f3

Browse files
authored
[cherry-pick] Image matrix (#5950)
1 parent c04845a commit 4ec11f3

File tree

8 files changed

+161
-243
lines changed

8 files changed

+161
-243
lines changed

.github/data/matrix-images-nap.json

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"image": [
3+
"debian-plus-nap"
4+
],
5+
"platforms": [
6+
"linux/amd64"
7+
],
8+
"target": [
9+
"goreleaser",
10+
"aws"
11+
],
12+
"nap_modules": [
13+
"dos",
14+
"waf",
15+
"waf,dos"
16+
],
17+
"include": [
18+
{
19+
"image": "ubi-9-plus-nap",
20+
"target": "goreleaser",
21+
"platforms": "linux/amd64",
22+
"nap_modules": "waf"
23+
},
24+
{
25+
"image": "ubi-8-plus-nap",
26+
"target": "goreleaser",
27+
"platforms": "linux/amd64",
28+
"nap_modules": "dos"
29+
},
30+
{
31+
"image": "ubi-8-plus-nap",
32+
"target": "goreleaser",
33+
"platforms": "linux/amd64",
34+
"nap_modules": "waf,dos"
35+
},
36+
{
37+
"image": "ubi-9-plus-nap",
38+
"target": "aws",
39+
"platforms": "linux/amd64",
40+
"nap_modules": "waf"
41+
},
42+
{
43+
"image": "ubi-8-plus-nap",
44+
"target": "aws",
45+
"platforms": "linux/amd64",
46+
"nap_modules": "dos"
47+
},
48+
{
49+
"image": "ubi-8-plus-nap",
50+
"target": "aws",
51+
"platforms": "linux/amd64",
52+
"nap_modules": "waf,dos"
53+
},
54+
{
55+
"image": "alpine-plus-nap-fips",
56+
"target": "goreleaser",
57+
"platforms": "linux/amd64",
58+
"nap_modules": "waf"
59+
},
60+
{
61+
"image": "alpine-plus-nap-v5-fips",
62+
"target": "goreleaser",
63+
"platforms": "linux/amd64",
64+
"nap_modules": "waf"
65+
},
66+
{
67+
"image": "debian-plus-nap-v5",
68+
"target": "goreleaser",
69+
"platforms": "linux/amd64",
70+
"nap_modules": "waf"
71+
},
72+
{
73+
"image": "ubi-9-plus-nap-v5",
74+
"target": "goreleaser",
75+
"platforms": "linux/amd64",
76+
"nap_modules": "waf"
77+
},
78+
{
79+
"image": "ubi-8-plus-nap-v5",
80+
"target": "goreleaser",
81+
"platforms": "linux/amd64",
82+
"nap_modules": "waf"
83+
}
84+
]
85+
}

.github/data/matrix-images-oss.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"image": [
3+
"debian",
4+
"alpine"
5+
],
6+
"platforms": [
7+
"linux/arm, linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"
8+
],
9+
"include": [
10+
{
11+
"image": "ubi",
12+
"platforms": "linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"
13+
}
14+
]
15+
}

.github/data/matrix-images-plus.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"image": [
3+
"debian-plus",
4+
"alpine-plus",
5+
"alpine-plus-fips"
6+
],
7+
"platforms": [
8+
"linux/arm64, linux/amd64"
9+
],
10+
"target": [
11+
"goreleaser",
12+
"aws"
13+
],
14+
"include": [
15+
{
16+
"image": "ubi-plus",
17+
"platforms": "linux/arm64, linux/amd64, linux/s390x",
18+
"target": "goreleaser"
19+
}
20+
]
21+
}

.github/workflows/build-base-images.yml

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
outputs:
2525
docker_md5: ${{ steps.vars.outputs.docker_md5 }}
2626
ic_version: ${{ steps.vars.outputs.ic_version }}
27+
image_matrix_oss: ${{ steps.vars.outputs.image_matrix_oss }}
28+
image_matrix_plus: ${{ steps.vars.outputs.image_matrix_plus }}
29+
image_matrix_nap: ${{ steps.vars.outputs.image_matrix_nap }}
2730
steps:
2831
- name: Checkout Repository
2932
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -34,6 +37,9 @@ jobs:
3437
./.github/scripts/variables.sh docker_md5 >> $GITHUB_OUTPUT
3538
source .github/data/version.txt
3639
echo "ic_version=${IC_VERSION}" >> $GITHUB_OUTPUT
40+
echo "image_matrix_oss=$(cat .github/data/matrix-images-oss.json | jq -c)" >> $GITHUB_OUTPUT
41+
echo "image_matrix_plus=$(cat .github/data/matrix-images-plus.json | jq -c)" >> $GITHUB_OUTPUT
42+
echo "image_matrix_nap=$(cat .github/data/matrix-images-nap.json | jq -c)" >> $GITHUB_OUTPUT
3743
cat $GITHUB_OUTPUT
3844
3945
build-oss:
@@ -46,13 +52,7 @@ jobs:
4652
id-token: write
4753
strategy:
4854
fail-fast: false
49-
matrix:
50-
image: [debian, alpine]
51-
platforms:
52-
["linux/arm, linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"]
53-
include:
54-
- image: ubi
55-
platforms: "linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"
55+
matrix: ${{ fromJSON( needs.checks.outputs.image_matrix_oss ) }}
5656
steps:
5757
- name: Checkout Repository
5858
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -117,12 +117,7 @@ jobs:
117117
pull-requests: write # for scout report
118118
strategy:
119119
fail-fast: false
120-
matrix:
121-
image: [debian-plus, alpine-plus, alpine-plus-fips]
122-
platforms: ["linux/arm64, linux/amd64"]
123-
include:
124-
- image: ubi-plus
125-
platforms: "linux/arm64, linux/amd64, linux/s390x"
120+
matrix: ${{ fromJSON( needs.checks.outputs.image_matrix_plus ) }}
126121
steps:
127122
- name: Checkout Repository
128123
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -190,39 +185,7 @@ jobs:
190185
pull-requests: write # for scout report
191186
strategy:
192187
fail-fast: false
193-
matrix:
194-
image: [debian-plus-nap]
195-
platforms: ["linux/amd64"]
196-
nap_modules: [dos, waf, "waf,dos"]
197-
include:
198-
- image: ubi-9-plus-nap
199-
platforms: "linux/amd64"
200-
nap_modules: waf
201-
- image: ubi-8-plus-nap
202-
platforms: "linux/amd64"
203-
nap_modules: dos
204-
- image: ubi-8-plus-nap
205-
platforms: "linux/amd64"
206-
nap_modules: "waf,dos"
207-
- image: alpine-plus-nap-fips
208-
platforms: "linux/amd64"
209-
nap_modules: waf
210-
- image: alpine-plus-nap-v5-fips
211-
target: goreleaser
212-
platforms: "linux/amd64"
213-
nap_modules: waf
214-
- image: debian-plus-nap-v5
215-
target: goreleaser
216-
platforms: "linux/amd64"
217-
nap_modules: waf
218-
- image: ubi-9-plus-nap-v5
219-
target: goreleaser
220-
platforms: "linux/amd64"
221-
nap_modules: waf
222-
- image: ubi-8-plus-nap-v5
223-
target: goreleaser
224-
platforms: "linux/amd64"
225-
nap_modules: waf
188+
matrix: ${{ fromJSON( needs.checks.outputs.image_matrix_nap ) }}
226189
steps:
227190
- name: Checkout Repository
228191
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

.github/workflows/build-oss.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ jobs:
229229
summary: true
230230
if: ${{ inputs.authenticated && steps.build-push.conclusion == 'success' }}
231231

232-
- name: Upload Scan Results to the cache
232+
- name: Upload Scan Results to Github Artifacts
233233
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
234234
continue-on-error: true
235235
with:

.github/workflows/cache-update.yml

Lines changed: 9 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
outputs:
2222
go_code_md5: ${{ steps.vars.outputs.go_code_md5 }}
2323
docker_md5: ${{ steps.vars.outputs.docker_md5 }}
24+
image_matrix_oss: ${{ steps.vars.outputs.image_matrix_oss }}
25+
image_matrix_plus: ${{ steps.vars.outputs.image_matrix_plus }}
26+
image_matrix_nap: ${{ steps.vars.outputs.image_matrix_nap }}
2427
steps:
2528
- name: Checkout Repository
2629
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -30,21 +33,17 @@ jobs:
3033
run: |
3134
./.github/scripts/variables.sh go_code_md5 >> $GITHUB_OUTPUT
3235
./.github/scripts/variables.sh docker_md5 >> $GITHUB_OUTPUT
33-
source .github/data/version.txt
36+
echo "image_matrix_oss=$(cat .github/data/matrix-images-oss.json | jq -c)" >> $GITHUB_OUTPUT
37+
echo "image_matrix_plus=$(cat .github/data/matrix-images-plus.json | jq -c)" >> $GITHUB_OUTPUT
38+
echo "image_matrix_nap=$(cat .github/data/matrix-images-nap.json | jq -c)" >> $GITHUB_OUTPUT
3439
cat $GITHUB_OUTPUT
3540
3641
build-docker:
3742
name: Build Docker OSS
3843
needs: [checks]
3944
strategy:
4045
fail-fast: false
41-
matrix:
42-
image: [debian, alpine]
43-
platforms:
44-
["linux/arm, linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"]
45-
include:
46-
- image: ubi
47-
platforms: "linux/arm64, linux/amd64, linux/ppc64le, linux/s390x"
46+
matrix: ${{ fromJSON( needs.checks.outputs.image_matrix_oss ) }}
4847
uses: ./.github/workflows/build-oss.yml
4948
with:
5049
platforms: ${{ matrix.platforms }}
@@ -68,14 +67,7 @@ jobs:
6867
needs: [checks]
6968
strategy:
7069
fail-fast: false
71-
matrix:
72-
image: [debian-plus, alpine-plus, alpine-plus-fips]
73-
platforms: ["linux/arm64, linux/amd64"]
74-
target: [goreleaser, aws]
75-
include:
76-
- image: ubi-plus
77-
platforms: "linux/arm64, linux/amd64, linux/s390x"
78-
target: goreleaser
70+
matrix: ${{ fromJSON( needs.checks.outputs.image_matrix_plus ) }}
7971
uses: ./.github/workflows/build-plus.yml
8072
with:
8173
platforms: ${{ matrix.platforms }}
@@ -98,56 +90,7 @@ jobs:
9890
needs: [checks]
9991
strategy:
10092
fail-fast: false
101-
matrix:
102-
image: [debian-plus-nap]
103-
platforms: ["linux/amd64"]
104-
target: [goreleaser, aws]
105-
nap_modules: [dos, waf, "waf,dos"]
106-
include:
107-
- image: ubi-9-plus-nap
108-
target: goreleaser
109-
platforms: "linux/amd64"
110-
nap_modules: waf
111-
- image: ubi-8-plus-nap
112-
target: goreleaser
113-
platforms: "linux/amd64"
114-
nap_modules: dos
115-
- image: ubi-8-plus-nap
116-
target: goreleaser
117-
platforms: "linux/amd64"
118-
nap_modules: "waf,dos"
119-
- image: ubi-9-plus-nap
120-
target: aws
121-
platforms: "linux/amd64"
122-
nap_modules: waf
123-
- image: ubi-8-plus-nap
124-
target: aws
125-
platforms: "linux/amd64"
126-
nap_modules: dos
127-
- image: ubi-8-plus-nap
128-
target: aws
129-
platforms: "linux/amd64"
130-
nap_modules: "waf,dos"
131-
- image: alpine-plus-nap-fips
132-
target: goreleaser
133-
platforms: "linux/amd64"
134-
nap_modules: waf
135-
- image: alpine-plus-nap-v5-fips
136-
target: goreleaser
137-
platforms: "linux/amd64"
138-
nap_modules: waf
139-
- image: debian-plus-nap-v5
140-
target: goreleaser
141-
platforms: "linux/amd64"
142-
nap_modules: waf
143-
- image: ubi-9-plus-nap-v5
144-
target: goreleaser
145-
platforms: "linux/amd64"
146-
nap_modules: waf
147-
- image: ubi-8-plus-nap-v5
148-
target: goreleaser
149-
platforms: "linux/amd64"
150-
nap_modules: waf
93+
matrix: ${{ fromJSON( needs.checks.outputs.image_matrix_nap ) }}
15194
uses: ./.github/workflows/build-plus.yml
15295
with:
15396
platforms: ${{ matrix.platforms }}

0 commit comments

Comments
 (0)