Skip to content

Commit 337555d

Browse files
Test promotion playbook
1 parent 31d5eac commit 337555d

File tree

3 files changed

+234
-328
lines changed

3 files changed

+234
-328
lines changed

.github/workflows/ipa-image-build.yml

Lines changed: 89 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
name: Build IPA images
33
on:
44
workflow_dispatch:
5+
inputs:
6+
rocky9:
7+
description: Build Rocky Linux 9
8+
type: boolean
9+
default: true
10+
ubuntu-jammy:
11+
description: Build Ubuntu 22.04 Jammy
12+
type: boolean
13+
default: true
514
secrets:
615
KAYOBE_VAULT_PASSWORD:
716
required: true
@@ -84,33 +93,20 @@ jobs:
8493
EOF
8594
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio
8695

87-
- name: Output image tag
88-
id: image_tag
89-
run: |
90-
echo image_tag=$(grep stackhpc_ubuntu_jammy_overcloud_host_image_version: etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
91-
working-directory: ${{ github.workspace }}/src/kayobe-config
92-
93-
# Use the image override if set, otherwise use overcloud-os_distribution-os_release-tag
94-
- name: Output image name
95-
id: image_name
96-
run: |
97-
echo image_name=overcloud-ubuntu-jammy-${{ steps.image_tag.outputs.image_tag }} >> $GITHUB_OUTPUT
98-
9996
- name: Generate terraform.tfvars
10097
run: |
10198
cat << EOF > terraform.tfvars
10299
ssh_public_key = "id_rsa.pub"
103100
ssh_username = "ubuntu"
104101
aio_vm_name = "skc-ipa-image-builder"
105-
aio_vm_image = "${{ env.VM_IMAGE }}"
106-
aio_vm_flavor = "en1.medium"
102+
aio_vm_image = "Ubuntu-22.04"
103+
aio_vm_flavor = "en1.large"
107104
aio_vm_network = "stackhpc-ci"
108105
aio_vm_subnet = "stackhpc-ci"
109106
aio_vm_interface = "ens3"
107+
aio_vm_volume_size = 100
110108
EOF
111109
working-directory: ${{ github.workspace }}/src/kayobe-config/terraform/aio
112-
env:
113-
VM_IMAGE: ${{ steps.image_name.outputs.image_name }}
114110

115111
- name: Terraform Plan
116112
run: terraform plan
@@ -182,16 +178,6 @@ jobs:
182178
source src/kayobe-config/kayobe-env --environment ci-builder &&
183179
kayobe control host bootstrap
184180
185-
- name: Growpart
186-
run: |
187-
source venvs/kayobe/bin/activate &&
188-
source src/kayobe-config/kayobe-env --environment ci-builder &&
189-
kayobe playbook run src/kayobe-config/etc/kayobe/ansible/growroot.yml \
190-
-e growroot_group="seed" \
191-
-e seed_bootstrap_user="ubuntu"
192-
env:
193-
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
194-
195181
- name: Configure the seed host (Builder VM)
196182
run: |
197183
source venvs/kayobe/bin/activate &&
@@ -211,17 +197,19 @@ jobs:
211197
env:
212198
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
213199

214-
- name: Build an Ironic Python Agent (IPA) image
215-
id: build_ipa
200+
- name: Build a Ubuntu 22.04 Jammy IPA image
201+
id: build_ubuntu_jammy_ipa
216202
continue-on-error: true
217203
run: |
218204
source venvs/kayobe/bin/activate &&
219205
source src/kayobe-config/kayobe-env --environment ci-builder &&
220206
kayobe overcloud deployment image build --force-rebuild \
221207
-e os_distribution="ubuntu" \
222208
-e os_release="jammy" \
209+
-e ipa_ci_builder_distribution="ubuntu"
223210
env:
224211
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
212+
if: inputs.ubuntu-jammy
225213

226214
- name: Show last error logs
227215
continue-on-error: true
@@ -231,39 +219,95 @@ jobs:
231219
kayobe seed host command run --command "tail -200 /opt/kayobe/images/ipa/ipa.stdout" --show-output
232220
env:
233221
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
234-
if: steps.build_ipa.outcome == 'failure'
222+
if: steps.build_ubuntu_jammy_ipa.outcome == 'failure'
235223

236-
- name: Upload IPA kernel image to Ark
224+
- name: Upload Ubuntu 22.04 Jammy IPA kernel image to Ark
237225
run: |
238226
source venvs/kayobe/bin/activate &&
239227
source src/kayobe-config/kayobe-env --environment ci-builder &&
240228
kayobe playbook run \
241-
src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \
242-
-e image_path=/opt/kayobe/images/ipa \
243-
-e image_name=ipa \
244-
-e image_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
229+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
230+
-e artifact_path=/opt/kayobe/images/ipa \
231+
-e artifact_type=ipa \
232+
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
245233
-e os_distribution="ubuntu" \
246234
-e os_release="jammy" \
247-
-e file_extension='kernel'
235+
-e file_regex='*.kernel'
248236
env:
249237
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
250-
if: steps.build_ipa.outcome == 'success'
238+
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy_ipa.outcome == 'success'
251239

252-
- name: Upload IPA ramdisk image to Ark
240+
- name: Upload Ubuntu 22.04 Jammy IPA ramdisk image to Ark
253241
run: |
254242
source venvs/kayobe/bin/activate &&
255243
source src/kayobe-config/kayobe-env --environment ci-builder &&
256244
kayobe playbook run \
257-
src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \
258-
-e image_path=/opt/kayobe/images/ipa \
259-
-e image_name=ipa \
260-
-e image_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
245+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
246+
-e artifact_path=/opt/kayobe/images/ipa \
247+
-e artifact_type=ipa \
248+
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
261249
-e os_distribution="ubuntu" \
262250
-e os_release="jammy" \
263-
-e file_extension='initramfs'
251+
-e file_regex='*.initramfs'
252+
env:
253+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
254+
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy_ipa.outcome == 'success'
255+
256+
- name: Build a Rocky 9 IPA image
257+
id: build_rocky_9_ipa
258+
continue-on-error: true
259+
run: |
260+
source venvs/kayobe/bin/activate &&
261+
source src/kayobe-config/kayobe-env --environment ci-builder &&
262+
kayobe overcloud deployment image build --force-rebuild \
263+
-e os_distribution="rocky" \
264+
-e os_release="9" \
265+
-e ipa_ci_builder_distribution="rocky"
266+
env:
267+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
268+
if: inputs.rocky9
269+
270+
- name: Show last error logs
271+
continue-on-error: true
272+
run: |
273+
source venvs/kayobe/bin/activate &&
274+
source src/kayobe-config/kayobe-env --environment ci-builder &&
275+
kayobe seed host command run --command "tail -200 /opt/kayobe/images/ipa/ipa.stdout" --show-output
276+
env:
277+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
278+
if: steps.build_rocky_9_ipa.outcome == 'failure'
279+
280+
- name: Upload Rocky 9 IPA kernel image to Ark
281+
run: |
282+
source venvs/kayobe/bin/activate &&
283+
source src/kayobe-config/kayobe-env --environment ci-builder &&
284+
kayobe playbook run \
285+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
286+
-e artifact_path=/opt/kayobe/images/ipa \
287+
-e artifact_type=ipa \
288+
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
289+
-e os_distribution="rocky" \
290+
-e os_release="9" \
291+
-e file_regex='*.kernel'
292+
env:
293+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
294+
if: inputs.rocky9 && steps.build_rocky_9_ipa.outcome == 'success'
295+
296+
- name: Upload Rocky 9 IPA ramdisk image to Ark
297+
run: |
298+
source venvs/kayobe/bin/activate &&
299+
source src/kayobe-config/kayobe-env --environment ci-builder &&
300+
kayobe playbook run \
301+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
302+
-e artifact_path=/opt/kayobe/images/ipa \
303+
-e artifact_type=ipa \
304+
-e artifact_tag=${{ steps.ipa_image_tag.outputs.ipa_image_tag }} \
305+
-e os_distribution="rocky" \
306+
-e os_release="9" \
307+
-e file_regex='*.initramfs'
264308
env:
265309
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
266-
if: steps.build_ipa.outcome == 'success'
310+
if: inputs.rocky9 && steps.build_rocky_9_ipa.outcome == 'success'
267311

268312
- name: Copy logs back
269313
continue-on-error: true
@@ -282,7 +326,8 @@ jobs:
282326
run: |
283327
echo "Builds failed. See workflow artifacts for details." &&
284328
exit 1
285-
if: steps.build_ipa.outcome == 'failure'
329+
if: steps.build_rocky_9_ipa.outcome == 'failure' ||
330+
steps.build_ubuntu_jammy_ipa.outcome == 'failure'
286331

287332
- name: Destroy
288333
run: terraform destroy -auto-approve
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
name: Promote IPA image
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
rocky9:
7+
description: Promote Rocky Linux 9
8+
type: boolean
9+
default: true
10+
ubuntu-jammy:
11+
description: Promote Ubuntu 22.04 Jammy
12+
type: boolean
13+
default: true
14+
image_tag:
15+
description: Tag to promote
16+
type: string
17+
required: true
18+
env:
19+
ANSIBLE_FORCE_COLOR: True
20+
jobs:
21+
overcloud-host-image-promote:
22+
name: Promote IPA image
23+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
24+
runs-on: ubuntu-22.04
25+
steps:
26+
- name: Validate inputs
27+
run: |
28+
if [[ ${{ inputs.rocky9 }} == 'false' && ${{ inputs.ubuntu-jammy }} == 'false' ]]; then
29+
echo "At least one distribution must be selected"
30+
exit 1
31+
fi
32+
33+
- uses: actions/checkout@v4
34+
with:
35+
path: src/kayobe-config
36+
37+
- name: Determine OpenStack release
38+
id: openstack_release
39+
run: |
40+
BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' .gitreview)
41+
echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," >> $GITHUB_OUTPUT
42+
working-directory: src/kayobe-config
43+
44+
- name: Setup networking
45+
run: |
46+
if ! ip l show breth1 >/dev/null 2>&1; then
47+
sudo ip l add breth1 type bridge
48+
fi
49+
sudo ip l set breth1 up
50+
if ! ip a show breth1 | grep 192.168.33.3/24; then
51+
sudo ip a add 192.168.33.3/24 dev breth1
52+
fi
53+
if ! ip l show dummy1 >/dev/null 2>&1; then
54+
sudo ip l add dummy1 type dummy
55+
fi
56+
sudo ip l set dummy1 up
57+
sudo ip l set dummy1 master breth1
58+
59+
- name: Install Kayobe
60+
run: |
61+
mkdir -p venvs &&
62+
pushd venvs &&
63+
python3 -m venv kayobe &&
64+
source kayobe/bin/activate &&
65+
pip install -U pip &&
66+
pip install -r ../src/kayobe-config/requirements.txt
67+
68+
- name: Bootstrap the control host
69+
run: |
70+
source venvs/kayobe/bin/activate &&
71+
source src/kayobe-config/kayobe-env --environment ci-builder &&
72+
kayobe control host bootstrap
73+
74+
- name: Promote Rocky Linux 9 IPA image artifact
75+
run: |
76+
source venvs/kayobe/bin/activate &&
77+
source src/kayobe-config/kayobe-env --environment ci-builder &&
78+
kayobe playbook run \
79+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \
80+
-e artifact_type="ipa" \
81+
-e os_distribution='rocky' \
82+
-e os_release='9'
83+
env:
84+
ARTIFACT_TAG: ${{ inputs.image_tag }}
85+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
86+
if: inputs.rocky9
87+
88+
- name: Promote Ubuntu Jammy 22.04 IPA image artifact
89+
run: |
90+
source venvs/kayobe/bin/activate &&
91+
source src/kayobe-config/kayobe-env --environment ci-builder &&
92+
kayobe playbook run \
93+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \
94+
-e artifact_type="ipa" \
95+
-e os_distribution='ubuntu' \
96+
-e os_release='jammy'
97+
env:
98+
ARTIFACT_TAG: ${{ inputs.image_tag }}
99+
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
100+
if: inputs.ubuntu-jammy

0 commit comments

Comments
 (0)