-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathcontinuous-integration-workflow.yml
More file actions
372 lines (359 loc) · 12.5 KB
/
continuous-integration-workflow.yml
File metadata and controls
372 lines (359 loc) · 12.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
name: Continous Integration Tests
on: [ push, pull_request ]
jobs:
jenkins-agent-base-ubi9:
name: Jenkins agent base (UBI9)
runs-on: ubuntu-24.04
steps:
-
name: Checkout ods-core repository
uses: actions/checkout@v6.0.2
with:
repository: ${{ github.repository_owner }}/ods-core
token: ${{ secrets.GH_REPO_READ_TOKEN || github.token }}
path: ods-core
-
name: Login to Red Hat Registry
uses: docker/login-action@v4.1.0
with:
registry: registry.redhat.io
username: ${{ secrets.REDHAT_REGISTRY_USERNAME }}
password: ${{ secrets.REDHAT_REGISTRY_PASSWORD }}
-
name: Build base docker image
working-directory: ods-core/jenkins/agent-base
run: |
docker build --tag opendevstackorg/ods-jenkins-agent-base-ubi9:latest --file Dockerfile.ubi9 .
-
name: Save base image as artifact
run: |
docker save --output ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar opendevstackorg/ods-jenkins-agent-base-ubi9:latest
-
name: Upload base image artifact
uses: actions/upload-artifact@v7.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
jenkins-agent-golang-ubi9:
name: Jenkins agent Go (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/golang/docker
run: |
docker build --tag agent-go-test-ubi9 --file Dockerfile.ubi9 \
--build-arg goDistributionUrl=https://go.dev/dl/go1.23.0.linux-amd64.tar.gz \
--build-arg golangciVersion=v1.60.1 \
.
jenkins-agent-jdk-ubi9:
name: Jenkins agent JDK (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/jdk/docker
run: |
docker build --tag agent-jdk-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusUsername=developer \
--build-arg nexusPassword=s3cr3t \
.
jenkins-agent-nodejs18-ubi9:
name: Jenkins agent NodeJS 18 (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/nodejs18/docker
run: |
docker build --tag agent-nodejs18-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusAuth=developer:s3cr3t \
.
jenkins-agent-nodejs20-ubi9:
name: Jenkins agent NodeJS 20 (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/nodejs20/docker
run: |
docker build --tag agent-nodejs20-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusAuth=developer:s3cr3t \
.
jenkins-agent-nodejs22-ubi9:
name: Jenkins agent NodeJS 22 (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/nodejs22/docker
run: |
docker build --tag agent-nodejs22-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusAuth=developer:s3cr3t \
.
jenkins-agent-nodejs24-ubi9:
name: Jenkins agent NodeJS 24 (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/nodejs24/docker
run: |
docker build --tag agent-nodejs24-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusAuth=developer:s3cr3t \
.
jenkins-agent-python-ubi9:
name: Jenkins agent Python (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/python/docker
run: |
docker build --tag agent-python-test-ubi9 --file Dockerfile.ubi9 .
jenkins-agent-rust-ubi9:
name: Jenkins agent Rust (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/rust/docker
run: |
docker build --tag agent-rust-test-ubi9 --file Dockerfile.ubi9 \
--build-arg rustVersion=1.94.1 \
--build-arg rustToolchain=x86_64-unknown-linux-gnu \
--build-arg cargoNextestVersion=0.9.132 \
--build-arg cargoLlvmCovVersion=0.8.5 \
--build-arg cargoGenerateVersion=0.23.8 \
--build-arg cargoDenyVersion=0.19.1 \
.
jenkins-agent-terraform-2306-ubi9:
name: Jenkins agent Terraform 2306 (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/terraform-2306/docker
run: |
docker build --tag agent-terraform-2306-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusAuth=developer:s3cr3t \
--build-arg NPMJS_REGISTRY_FLAG=--registry=https://registry.npmjs.org \
.
jenkins-agent-terraform-2408-ubi9:
name: Jenkins agent Terraform 2408 (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/terraform-2408/docker
run: |
docker build --tag agent-terraform-2408-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusAuth=developer:s3cr3t \
--build-arg NPMJS_REGISTRY_FLAG=--registry=https://registry.npmjs.org \
.
jenkins-agent-scala-ubi9:
name: Jenkins agent Scala (UBI9)
runs-on: ubuntu-24.04
needs: [ jenkins-agent-base-ubi9 ]
steps:
-
name: Checkout repository
uses: actions/checkout@v6.0.2
-
name: Download base image artifact
uses: actions/download-artifact@v8.0.1
with:
name: jenkins-agent-base-ubi9
path: ${{ runner.temp }}
-
name: Load base image
run: |
docker load --input ${{ runner.temp }}/ods-jenkins-agent-base-ubi9.tar
-
name: Build docker image
working-directory: common/jenkins-agents/scala/docker
run: |
docker build --tag agent-scala-test-ubi9 --file Dockerfile.ubi9 \
--build-arg nexusUrl=https://nexus.example.com \
--build-arg nexusUsername=developer \
--build-arg nexusPassword=s3cr3t \
.
cleanup-artifact:
name: Cleanup base image artifact
runs-on: ubuntu-24.04
needs: [ jenkins-agent-golang-ubi9, jenkins-agent-jdk-ubi9, jenkins-agent-nodejs18-ubi9, jenkins-agent-nodejs20-ubi9, jenkins-agent-nodejs22-ubi9, jenkins-agent-nodejs24-ubi9, jenkins-agent-python-ubi9, jenkins-agent-rust-ubi9, jenkins-agent-terraform-2306-ubi9, jenkins-agent-terraform-2408-ubi9, jenkins-agent-scala-ubi9 ]
if: always()
steps:
-
name: Delete artifact
uses: actions/github-script@v9.0.0
with:
script: |
try {
const artifacts = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
name: 'jenkins-agent-base-ubi9'
});
if (artifacts.data.artifacts.length > 0) {
for (const artifact of artifacts.data.artifacts) {
await github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
});
console.log(`Deleted artifact: ${artifact.name}`);
}
} else {
console.log('No artifacts found to delete');
}
} catch (error) {
console.log(`Warning: Failed to delete artifact - ${error.message}`);
}