Skip to content

Commit 91cd9cd

Browse files
obnoxxxphlogistonjohnanoopcs9
committed
github: convert workflows to matrix with OS and arch as dimensions
this expands various existing jobs into multiple jobs by expanding matrix dimensions for the base operating system (os) ang build architecture (arch). It only covers the supported opersting systems Fedora and CentOS for a start but excludes CentOS for those images that are not supported yet, i. e. ad-server images. But it can also be considered a preparation for adding CentOS to the test matrix later when we will be adding ad-server Containerfiles for centos. Co-authored-by: John Mulligan <[email protected]> Signed-off-by: Michael Adam <[email protected]> Signed-off-by: John Mulligan <[email protected]> Co-authored-by: Anoop C S <[email protected]> Signed-off-by: Anoop C S <[email protected]>
1 parent f51b35f commit 91cd9cd

File tree

1 file changed

+88
-119
lines changed

1 file changed

+88
-119
lines changed

.github/workflows/container-image.yml

Lines changed: 88 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ on:
1010

1111
env:
1212
CONTAINER_CMD: docker
13-
1413
jobs:
15-
16-
check:
14+
checks:
1715
runs-on: ubuntu-latest
1816
steps:
1917
- uses: actions/checkout@v3
@@ -39,100 +37,67 @@ jobs:
3937

4038
build-server:
4139
runs-on: ubuntu-latest
40+
strategy:
41+
matrix:
42+
os: [centos, fedora]
43+
arch: [amd64]
4244
env:
4345
BUILDAH_FORMAT: oci
4446
steps:
4547
- uses: actions/checkout@v3
4648
- name: Build the server image
47-
run: make build-server
48-
- name: Upload server image
49-
uses: ishworkh/docker-image-artifact-upload@v1
50-
with:
51-
image: "samba-server:latest"
52-
retention_days: 1
53-
build-server-centos:
54-
runs-on: ubuntu-latest
55-
steps:
56-
- uses: actions/checkout@v3
57-
- name: Build the CentOS based server image
58-
run: make OS_NAME=centos build-server
49+
run: make OS_NAME=${{ matrix.os}} BUILD_ARCH=${{ matrix.arch}} build-server
5950
- name: Upload server image
6051
uses: ishworkh/docker-image-artifact-upload@v1
6152
with:
62-
image: "samba-server:centos-latest"
53+
image: "samba-server:${{ matrix.os }}-latest"
6354
retention_days: 1
6455

65-
test-server-centos:
66-
needs: build-server-centos
67-
runs-on: ubuntu-latest
68-
steps:
69-
- uses: actions/checkout@v3
70-
- name: Download server image
71-
uses: ishworkh/docker-image-artifact-download@v1
72-
with:
73-
image: "samba-server:centos-latest"
74-
- name: Test the server image
75-
run: LOCAL_TAG=samba-server:centos-latest tests/test-samba-container.sh
76-
7756
build-ad-server:
57+
strategy:
58+
matrix:
59+
os: [centos, fedora]
60+
arch: [amd64]
61+
exclude:
62+
- os: centos
7863
runs-on: ubuntu-latest
7964
env:
8065
BUILDAH_FORMAT: oci
8166
steps:
8267
- uses: actions/checkout@v3
8368
- name: Build the ad server image
84-
run: make build-ad-server
69+
run: make OS_NAME=${{matrix.os}} BUILD_ARCH=${{matrix.arch}} build-ad-server
8570
- name: Upload ad server image
8671
uses: ishworkh/docker-image-artifact-upload@v1
8772
with:
88-
image: "samba-ad-server:latest"
89-
retention_days: 1
90-
build-client-centos:
91-
runs-on: ubuntu-latest
92-
steps:
93-
- uses: actions/checkout@v3
94-
- name: Build the centos client image
95-
run: make OS_NAME=centos build-client
96-
# Here we upload samba-client image to artifacts locally for consumption
97-
# during samba-toolbox build process.
98-
- name: Upload client image
99-
uses: ishworkh/docker-image-artifact-upload@v1
100-
with:
101-
image: "quay.io/samba.org/samba-client:centos-latest"
73+
image: "samba-ad-server:${{ matrix.os}}-latest"
10274
retention_days: 1
10375

104-
build-toolbox-centos:
105-
needs: build-client-centos
106-
runs-on: ubuntu-latest
107-
steps:
108-
- uses: actions/checkout@v3
109-
# Download locally stored samba-client image to be used as base for building
110-
# samba-toolbox.
111-
- name: Download client image
112-
uses: ishworkh/docker-image-artifact-download@v1
113-
with:
114-
image: "quay.io/samba.org/samba-client:centos-latest"
115-
- name: Build the toolbox image
116-
run: make OS_NAME=centos build-toolbox
117-
118-
11976
build-client:
120-
runs-on: ubuntu-latest
77+
strategy:
78+
matrix:
79+
os: [centos, fedora]
80+
arch: [amd64]
12181
env:
12282
BUILDAH_FORMAT: oci
83+
runs-on: ubuntu-latest
12384
steps:
12485
- uses: actions/checkout@v3
125-
- name: Build the client image
126-
run: make build-client
86+
- name: build the client image
87+
run: make OS_NAME=${{ matrix.os }} BUILD_ARCH=${{ matrix.arch }} build-client
12788
# Here we upload samba-client image to artifacts locally for consumption
128-
# during samba-toolbox build process.
129-
- name: Upload client image
89+
# during the samba-toolbox build process.
90+
- name: Upload the client image
13091
uses: ishworkh/docker-image-artifact-upload@v1
13192
with:
132-
image: "quay.io/samba.org/samba-client:latest"
93+
image: "quay.io/samba.org/samba-client:${{ matrix.os }}-latest"
13394
retention_days: 1
13495

13596
build-toolbox:
97+
strategy:
98+
matrix:
99+
os: [centos, fedora]
100+
arch: [amd64]
136101
needs: build-client
137102
runs-on: ubuntu-latest
138103
env:
@@ -144,97 +109,96 @@ jobs:
144109
- name: Download client image
145110
uses: ishworkh/docker-image-artifact-download@v1
146111
with:
147-
image: "quay.io/samba.org/samba-client:latest"
112+
image: "quay.io/samba.org/samba-client:${{ matrix.os }}-latest"
148113
- name: Build the toolbox image
149-
run: make build-toolbox
114+
run: make OS_NAME=${{ matrix.os }} BUILD_ARCH=${{ matrix.arch }} build-toolbox
150115

151116
test-server:
117+
strategy:
118+
matrix:
119+
os: [centos, fedora]
120+
arch: [amd64]
152121
needs: build-server
153122
runs-on: ubuntu-latest
154123
steps:
155124
- uses: actions/checkout@v3
156125
- name: Download server image
157126
uses: ishworkh/docker-image-artifact-download@v1
158127
with:
159-
image: "samba-server:latest"
128+
image: "samba-server:${{ matrix.os }}-latest"
160129
- name: Test the server image
161-
run: tests/test-samba-container.sh
130+
run: LOCAL_TAG="samba-server:${{ matrix.os}}-latest" tests/test-samba-container.sh
162131

163132
# Reminder: the nightly-server images consume nightly samba rpm builds
164133
# it is not *just* an image that gets built nightly
165134
build-nightly-server:
166135
runs-on: ubuntu-latest
136+
strategy:
137+
matrix:
138+
os: [centos, fedora]
139+
arch: [amd64]
167140
env:
168141
BUILDAH_FORMAT: oci
169142
steps:
170143
- uses: actions/checkout@v3
171144
- name: Build the nightly server image
172-
run: make build-nightly-server
145+
run: make OS_NAME=${{ matrix.os }} BUILD_ARCH=${{ matrix.arch }} build-nightly-server
173146
- name: Upload nightly server image
174147
uses: ishworkh/docker-image-artifact-upload@v1
175148
with:
176-
image: "samba-server:nightly"
177-
retention_days: 1
178-
179-
build-nightly-server-centos:
180-
runs-on: ubuntu-latest
181-
env:
182-
BUILDAH_FORMAT: oci
183-
steps:
184-
- uses: actions/checkout@v3
185-
- name: Build the nightly server image
186-
run: make OS_NAME=centos build-nightly-server
187-
- name: Upload nightly server image
188-
uses: ishworkh/docker-image-artifact-upload@v1
189-
with:
190-
image: "samba-server:centos-nightly"
149+
image: "samba-server:${{ matrix.os }}-nightly"
191150
retention_days: 1
192151

193152
build-nightly-ad-server:
194153
runs-on: ubuntu-latest
154+
strategy:
155+
matrix:
156+
os: [centos, fedora]
157+
arch: [amd64]
158+
exclude:
159+
- os: centos
195160
env:
196161
BUILDAH_FORMAT: oci
197162
steps:
198163
- uses: actions/checkout@v3
199164
- name: Build the nightly ad server image
200-
run: make build-nightly-ad-server
201-
- name: Upload nightly ad server image
165+
run: make OS_NAME=${{ matrix.os }} BUILD_ARCH=${{ matrix.arch }} build-nightly-ad-server
166+
- name: Upload nightly AD server image
202167
uses: ishworkh/docker-image-artifact-upload@v1
203168
with:
204-
image: "samba-ad-server:nightly"
169+
image: "samba-ad-server:${{ matrix.os }}-nightly"
205170
retention_days: 1
206171

207172
test-nightly-server:
173+
strategy:
174+
matrix:
175+
os: [centos, fedora]
176+
arch: [amd64]
208177
needs: build-nightly-server
209178
runs-on: ubuntu-latest
210179
steps:
211180
- uses: actions/checkout@v3
212181
- name: Download nightly server image
213182
uses: ishworkh/docker-image-artifact-download@v1
214183
with:
215-
image: "samba-server:nightly"
184+
image: "samba-server:${{ matrix.os }}-nightly"
216185
- name: Test the nightly server image
217-
run: LOCAL_TAG=samba-server:nightly tests/test-samba-container.sh
218-
219-
test-nightly-server-centos:
220-
needs: build-nightly-server-centos
221-
runs-on: ubuntu-latest
222-
steps:
223-
- uses: actions/checkout@v3
224-
- name: Download nightly server image
225-
uses: ishworkh/docker-image-artifact-download@v1
226-
with:
227-
image: "samba-server:centos-nightly"
228-
- name: Test the nightly server image
229-
run: LOCAL_TAG=samba-server:centos-nightly tests/test-samba-container.sh
186+
run: LOCAL_TAG=samba-server:${{ matrix.os }}-nightly tests/test-samba-container.sh
230187

231188
test-ad-server-kubernetes:
189+
strategy:
190+
matrix:
191+
os: [centos, fedora]
192+
arch: [amd64]
193+
exclude:
194+
- os: centos
232195
needs:
233196
- build-ad-server
234197
- build-server
235-
#runs-on: ubuntu-latest
236198
# need to explicitly use 20.04 to avoid problems with jq...
237199
runs-on: ubuntu-20.04
200+
env:
201+
IMG_TAG: ${{ matrix.os }}-latest
238202
steps:
239203
- uses: actions/checkout@v3
240204
- uses: nolar/setup-k3d-k3s@v1
@@ -243,44 +207,49 @@ jobs:
243207
- name: Download ad server image
244208
uses: ishworkh/docker-image-artifact-download@v1
245209
with:
246-
image: "samba-ad-server:latest"
210+
image: "samba-ad-server:${{ matrix.os }}-latest"
247211
- name: import ad server image
248-
run: k3d image import samba-ad-server:latest
212+
run: k3d image import samba-ad-server:${{ matrix.os }}-latest
249213
- name: Download file server image
250214
uses: ishworkh/docker-image-artifact-download@v1
251215
with:
252-
image: "samba-server:latest"
216+
image: "samba-server:${{ matrix.os }}-latest"
253217
- name: import file server image
254-
run: k3d image import samba-server:latest
218+
run: k3d image import samba-server:${{ matrix.os }}-latest
255219
- name: run the ad-dc deployment test
256220
run: ./tests/test-samba-ad-server-kubernetes.sh
257221

258222
test-nightly-ad-server-kubernetes:
259-
needs:
260-
- build-nightly-ad-server
261-
- build-nightly-server
262-
#runs-on: ubuntu-latest
263-
# need to explicitly use 20.04 to avoid problems with jq...
264-
runs-on: ubuntu-20.04
265-
env:
266-
IMG_TAG: nightly
267-
steps:
223+
strategy:
224+
matrix:
225+
os: [centos, fedora]
226+
arch: [amd64]
227+
exclude:
228+
- os: centos
229+
needs:
230+
- build-nightly-server
231+
- build-nightly-ad-server
232+
# need to explicitly use 20.04 to avoid problems with jq...
233+
runs-on: ubuntu-20.04
234+
env:
235+
IMG_TAG: ${{ matrix.os }}-nightly
236+
steps:
268237
- uses: actions/checkout@v3
269238
- uses: nolar/setup-k3d-k3s@v1
270239
- name: get nodes
271240
run: kubectl get nodes
272241
- name: Download nightly ad server image
273242
uses: ishworkh/docker-image-artifact-download@v1
274243
with:
275-
image: "samba-ad-server:nightly"
244+
image: "samba-ad-server:${{ matrix.os }}-nightly"
276245
- name: import nightly ad server image
277-
run: k3d image import samba-ad-server:nightly
246+
run: k3d image import samba-ad-server:${{ matrix.os }}-nightly
278247
- name: Download nightly file server image
279248
uses: ishworkh/docker-image-artifact-download@v1
280249
with:
281-
image: "samba-server:nightly"
250+
image: "samba-server:${{ matrix.os }}-nightly"
282251
- name: import nightly file server image
283-
run: k3d image import samba-server:nightly
252+
run: k3d image import samba-server:${{ matrix.os }}-nightly
284253
- name: run the ad-dc deployment test
285254
run: ./tests/test-samba-ad-server-kubernetes.sh
286255

0 commit comments

Comments
 (0)