-
Notifications
You must be signed in to change notification settings - Fork 21
398 lines (365 loc) · 16 KB
/
overcloud-host-image-build.yml
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
---
name: Build overcloud host images
on:
workflow_dispatch:
inputs:
centos:
description: Build CentOS Stream 8
type: boolean
default: true
rocky8:
description: Build Rocky Linux 8
type: boolean
default: true
rocky9:
description: Build Rocky Linux 9
type: boolean
default: true
ubuntu-focal:
description: Build Ubuntu 20.04 Focal
type: boolean
default: true
ubuntu-jammy:
description: Build Ubuntu 22.04 Jammy
type: boolean
default: true
secrets:
KAYOBE_VAULT_PASSWORD:
required: true
CLOUDS_YAML:
required: true
OS_APPLICATION_CREDENTIAL_ID:
required: true
OS_APPLICATION_CREDENTIAL_SECRET:
required: true
env:
ANSIBLE_FORCE_COLOR: True
jobs:
overcloud-host-image-build:
name: Build overcloud host images
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
runs-on: arc-skc-host-image-builder-runner
permissions: {}
steps:
- name: Install package dependencies
run: |
sudo apt update
sudo apt install -y debootstrap gdisk zstd build-essential git unzip nodejs python3-wheel python3-pip python3-venv rpm dnf
- name: Checkout
uses: actions/checkout@v4
with:
path: src/kayobe-config
- name: Determine OpenStack release
id: openstack_release
run: |
BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' src/kayobe-config/.gitreview)
echo "openstack_release=${BRANCH}" | sed "s|stable/||" >> $GITHUB_OUTPUT
# Generate a tag to apply to all built overcloud host images.
- name: Generate overcloud host image tag
id: host_image_tag
run: |
echo "host_image_tag=$(date +${{ steps.openstack_release.outputs.openstack_release }}-%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT
- name: Display overcloud host image tag
run: |
echo "${{ steps.host_image_tag.outputs.host_image_tag }}"
- name: Clone StackHPC Kayobe repository
uses: actions/checkout@v4
with:
repository: stackhpc/kayobe
ref: refs/heads/stackhpc/${{ steps.openstack_release.outputs.openstack_release }}
path: src/kayobe
- name: Install Kayobe
run: |
mkdir -p venvs &&
pushd venvs &&
python3 -m venv kayobe &&
source kayobe/bin/activate &&
pip install -U pip &&
pip install ../src/kayobe
- name: Bootstrap the control host
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe control host bootstrap --skip-tags bootstrap
- name: Create bifrost_httpboot Docker volume
run: |
sudo mkdir -p /var/lib/docker/volumes/bifrost_httpboot/_data
- name: Generate clouds.yaml
run: |
cat << EOF > clouds.yaml
${{ secrets.CLOUDS_YAML }}
EOF
- name: Install OpenStack client
run: |
source venvs/kayobe/bin/activate &&
pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/${{ steps.openstack_release.outputs.openstack_release }}
- name: Build a CentOS Stream 8 overcloud host image
id: build_centos_stream_8
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe overcloud host image build --force-rebuild \
-e os_distribution="centos" \
-e os_release="8-stream" \
-e stackhpc_overcloud_dib_name=overcloud-centos-8-stream
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.centos
- name: Upload CentOS Stream 8 overcloud host image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
-e image_path=/opt/kayobe/images/overcloud-centos-8-stream \
-e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
-e os_distribution="centos" \
-e os_release="8-stream"
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.centos && steps.build_centos_stream_8.outcome == 'success'
- name: Upload CentOS Stream 8 overcloud host image to Cloud
run: |
source venvs/kayobe/bin/activate &&
openstack image create \
overcloud-centos-8-stream-${{ steps.host_image_tag.outputs.host_image_tag }} \
--container-format bare \
--disk-format qcow2 \
--file /opt/kayobe/images/overcloud-centos-8-stream/overcloud-centos-8-stream.qcow2 \
--shared \
--os-cloud openstack \
--progress
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
if: inputs.centos && steps.build_centos_stream_8.outcome == 'success'
- name: Build a Rocky Linux 8 overcloud host image
id: build_rocky_8
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe overcloud host image build --force-rebuild \
-e os_distribution="rocky" \
-e os_release="8" \
-e stackhpc_overcloud_dib_name=overcloud-rocky-8
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.rocky8
- name: Upload Rocky Linux 8 overcloud host image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
-e image_path=/opt/kayobe/images/overcloud-rocky-8 \
-e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
-e os_distribution="rocky" \
-e os_release="8"
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.rocky8 && steps.build_rocky_8.outcome == 'success'
- name: Upload Rocky Linux 8 overcloud host image to Cloud
run: |
source venvs/kayobe/bin/activate &&
openstack image create \
overcloud-rocky-8-${{ steps.host_image_tag.outputs.host_image_tag }} \
--container-format bare \
--disk-format qcow2 \
--file /opt/kayobe/images/overcloud-rocky-8/overcloud-rocky-8.qcow2 \
--shared \
--os-cloud openstack \
--progress
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
if: inputs.rocky8 && steps.build_rocky_8.outcome == 'success'
- name: Build a Rocky Linux 9 overcloud host image
id: build_rocky_9
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe overcloud host image build --force-rebuild \
-e os_distribution="rocky" \
-e os_release="9" \
-e stackhpc_overcloud_dib_name=overcloud-rocky-9
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.rocky9
- name: Upload Rocky Linux 9 overcloud host image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
-e image_path=/opt/kayobe/images/overcloud-rocky-9 \
-e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
-e os_distribution="rocky" \
-e os_release="9"
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.rocky9 && steps.build_rocky_9.outcome == 'success'
- name: Upload Rocky Linux 9 overcloud host image to Cloud
run: |
source venvs/kayobe/bin/activate &&
openstack image create \
overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }} \
--container-format bare \
--disk-format qcow2 \
--file /opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.qcow2 \
--shared \
--os-cloud openstack \
--progress
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
if: inputs.rocky9 && steps.build_rocky_9.outcome == 'success'
- name: Build an Ubuntu Focal 20.04 overcloud host image
id: build_ubuntu_focal
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe overcloud host image build --force-rebuild \
-e os_distribution="ubuntu" \
-e os_release="focal" \
-e stackhpc_overcloud_dib_name=overcloud-ubuntu-focal
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.ubuntu-focal
- name: Upload Ubuntu Focal 20.04 overcloud host image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
-e image_path=/opt/kayobe/images/overcloud-ubuntu-focal \
-e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
-e os_distribution="ubuntu" \
-e os_release="focal"
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.ubuntu-focal && steps.build_ubuntu_focal.outcome == 'success'
- name: Upload Ubuntu Focal 20.04 overcloud host image to Cloud
run: |
source venvs/kayobe/bin/activate &&
openstack image create \
overcloud-ubuntu-focal-${{ steps.host_image_tag.outputs.host_image_tag }} \
--container-format bare \
--disk-format qcow2 \
--file /opt/kayobe/images/overcloud-ubuntu-focal/overcloud-ubuntu-focal.qcow2 \
--shared \
--os-cloud openstack \
--progress
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
if: inputs.ubuntu-focal && steps.build_ubuntu_focal.outcome == 'success'
- name: Build an Ubuntu Jammy 22.04 overcloud host image
id: build_ubuntu_jammy
continue-on-error: true
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe overcloud host image build --force-rebuild \
-e os_distribution="ubuntu" \
-e os_release="jammy" \
-e stackhpc_overcloud_dib_name=overcloud-ubuntu-jammy
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.ubuntu-jammy
- name: Upload Ubuntu Jammy 22.04 overcloud host image to Ark
run: |
source venvs/kayobe/bin/activate &&
source src/kayobe-config/kayobe-env --environment ci-builder &&
kayobe playbook run \
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \
-e image_path=/opt/kayobe/images/overcloud-ubuntu-jammy \
-e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
-e os_distribution="ubuntu" \
-e os_release="jammy"
env:
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy.outcome == 'success'
- name: Upload Ubuntu Jammy 22.04 overcloud host image to Cloud
run: |
source venvs/kayobe/bin/activate &&
openstack image create \
overcloud-ubuntu-jammy-${{ steps.host_image_tag.outputs.host_image_tag }} \
--container-format bare \
--disk-format qcow2 \
--file /opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.qcow2 \
--shared \
--os-cloud openstack \
--progress
env:
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy.outcome == 'success'
- name: Upload updated images artifact
uses: actions/upload-artifact@v4
with:
name: Updated images list
path: /tmp/updated_images.txt
retention-days: 7
if: steps.build_centos_stream_8.outcome == 'success' ||
steps.build_rocky_8.outcome == 'success' ||
steps.build_rocky_9.outcome == 'success' ||
steps.build_ubuntu_focal.outcome == 'success' ||
steps.build_ubuntu_jammy.outcome == 'success'
- name: Upload CentOS build logs if build failed
uses: actions/upload-artifact@v4
with:
name: CentOS build logs
path: |
/opt/kayobe/images/overcloud-centos-8-stream/overcloud-centos-8-stream.stdout
/opt/kayobe/images/overcloud-centos-8-stream/overcloud-centos-8-stream.stderr
retention-days: 7
if: steps.build_centos_stream_8.outcome == 'failure'
- name: Upload Rocky 8 build logs if build failed
uses: actions/upload-artifact@v4
with:
name: Rocky 8 build logs
path: |
/opt/kayobe/images/overcloud-rocky-8/overcloud-rocky-8.stdout
/opt/kayobe/images/overcloud-rocky-8/overcloud-rocky-8.stderr
retention-days: 7
if: steps.build_rocky_8.outcome == 'failure'
- name: Upload Rocky 9 build logs if build failed
uses: actions/upload-artifact@v4
with:
name: Rocky 9 build logs
path: |
/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.stdout
/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.stderr
retention-days: 7
if: steps.build_rocky_9.outcome == 'failure'
- name: Upload Ubuntu Focal 20.04 build logs if build failed
uses: actions/upload-artifact@v4
with:
name: Ubuntu Focal 20.04 build logs
path: |
/opt/kayobe/images/overcloud-ubuntu-focal/overcloud-ubuntu-focal.stdout
/opt/kayobe/images/overcloud-ubuntu-focal/overcloud-ubuntu-focal.stderr
retention-days: 7
if: steps.build_ubuntu_focal.outcome == 'failure'
- name: Upload Ubuntu Jammy 22.04 build logs if build failed
uses: actions/upload-artifact@v4
with:
name: Ubuntu Jammy 22.04 build logs
path: |
/opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.stdout
/opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.stderr
retention-days: 7
if: steps.build_ubuntu_jammy.outcome == 'failure'
- name: Fail if any overcloud host image builds failed
run: |
echo "Builds failed. See workflow artifacts for details." &&
exit 1
if: steps.build_centos_stream_8.outcome == 'failure' ||
steps.build_rocky_8.outcome == 'failure' ||
steps.build_rocky_9.outcome == 'failure' ||
steps.build_ubuntu_focal.outcome == 'failure' ||
steps.build_ubuntu_jammy.outcome == 'failure'