Skip to content

Commit d0f5633

Browse files
MoteHueAlex-Welsh
authored andcommitted
Automatically build overcloud host images
Trigger building new overcloud host images when a change to pulp-repo-versions.yml is pushed to stackhpc/2025.1.
1 parent fb944bb commit d0f5633

8 files changed

+183
-11
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file is a list of path filters for the overcloud host image build workflow in .github/workflows/trigger-overcloud-host-image-build.yml.
2+
pulp-repo-versions: &pulp-repo-versions
3+
- 'etc/kayobe/pulp-repo-versions.yml'
File renamed without changes.

.github/workflows/overcloud-host-image-build.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ on:
1818
options:
1919
- SMS Lab
2020
- Leafcloud
21+
create_skc_pr:
22+
description: Propose PR to SKC
23+
type: boolean
24+
default: true
2125
secrets:
2226
KAYOBE_VAULT_PASSWORD:
2327
required: true
@@ -44,7 +48,8 @@ jobs:
4448
runs-on: ${{ needs.runner-selection.outputs.runner_name_image_build }}
4549
needs:
4650
- runner-selection
47-
permissions: {}
51+
permissions:
52+
actions: write
4853
steps:
4954
- name: Validate inputs
5055
run: |
@@ -56,7 +61,7 @@ jobs:
5661
- name: Install Package
5762
uses: ConorMacBride/install-package@main
5863
with:
59-
apt: git unzip nodejs python3-pip python3-venv openssh-server openssh-client jq
64+
apt: git unzip nodejs python3-pip python3-venv openssh-server openssh-client jq gh
6065

6166
- name: Start the SSH service
6267
run: |
@@ -390,3 +395,43 @@ jobs:
390395
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
391396
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
392397
if: always()
398+
399+
- name: Trigger update overcloud host image tags
400+
run: |
401+
gh workflow run \
402+
update-overcloud-host-image-tags.yml \
403+
--repo stackhpc/stackhpc-kayobe-config \
404+
--ref $BRANCH_NAME \
405+
$(if [[ "${{ inputs.rocky9 }}" == "true" ]]; then echo "-f rocky9_tag=${{ steps.host_image_tag.outputs.host_image_tag }}"; fi) \
406+
$(if [[ "${{ inputs.ubuntu-noble }}" == "true" ]]; then echo "-f ubuntu_noble_tag=${{ steps.host_image_tag.outputs.host_image_tag }}"; fi)
407+
env:
408+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
409+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
410+
if: inputs.create_skc_pr
411+
412+
- name: Display link to update overcloud host image tags workflows
413+
run: |
414+
echo "::notice Overcloud host image promote workflow: https://github.com/stackhpc/stackhpc-kayobe-config/actions/workflows/update-overcloud-host-image-tags.yml"
415+
if: inputs.create_skc_pr
416+
417+
- name: Send message to Slack via Workflow Builder
418+
uses: slackapi/[email protected]
419+
with:
420+
payload: |
421+
{
422+
"channel-id": "${{ env.SLACK_CHANNEL_ID }}",
423+
"inputs": "${{ env.INPUTS }}",
424+
"message": "${{ env.MESSAGE }}",
425+
"results-url": "${{ env.RESULTS_URL }}",
426+
"workflow-url": "${{ env.WORKFLOW_URL }}"
427+
}
428+
env:
429+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
430+
# #release-train-alerts
431+
SLACK_CHANNEL_ID: C03B28HRP53
432+
INPUTS: >-
433+
branch: ${{ github.ref_name }}
434+
MESSAGE: "SKC overcloud host image build failed :sob:"
435+
RESULTS_URL: "N/A"
436+
WORKFLOW_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
437+
if: failure() && inputs.create_skc_pr

.github/workflows/overcloud-host-image-promote.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ on:
1111
description: Promote Ubuntu 24.04 Noble
1212
type: boolean
1313
default: true
14-
image_tag:
15-
description: Tag to promote
16-
type: string
17-
required: true
1814
env:
1915
ANSIBLE_FORCE_COLOR: True
2016
jobs:
@@ -71,6 +67,20 @@ jobs:
7167
source src/kayobe-config/kayobe-env --environment ci-builder &&
7268
kayobe control host bootstrap
7369
70+
- name: Gather Rocky Linux 9 overcloud host image tag
71+
id: rocky9_image_tag
72+
run: |
73+
echo image_tag=$(grep stackhpc_rocky_9_overcloud_host_image_version: etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
74+
working-directory: src/kayobe-config
75+
if: inputs.rocky9
76+
77+
- name: Gather Ubuntu Noble overcloud host image tag
78+
id: ubuntu_noble_image_tag
79+
run: |
80+
echo image_tag=$(grep stackhpc_ubuntu_noble_overcloud_host_image_version: etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
81+
working-directory: src/kayobe-config
82+
if: inputs.ubuntu-noble
83+
7484
- name: Promote Rocky Linux 9 overcloud host image artifact
7585
run: |
7686
source venvs/kayobe/bin/activate &&
@@ -79,9 +89,9 @@ jobs:
7989
src/kayobe-config/etc/kayobe/ansible/pulp/pulp-artifact-promote.yml \
8090
-e artifact_type="kayobe-images" \
8191
-e os_distribution='rocky' \
82-
-e os_release='9'
92+
-e os_release='9' \
93+
-e promotion_tag=${{ steps.rocky9_image_tag.outputs.image_tag }}
8394
env:
84-
ARTIFACT_TAG: ${{ inputs.image_tag }}
8595
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
8696
if: inputs.rocky9
8797

@@ -93,8 +103,8 @@ jobs:
93103
src/kayobe-config/etc/kayobe/ansible/pulp/pulp-artifact-promote.yml \
94104
-e artifact_type="kayobe-images" \
95105
-e os_distribution='ubuntu' \
96-
-e os_release='noble'
106+
-e os_release='noble' \
107+
-e promotion_tag=${{ steps.ubuntu_noble_image_tag.outputs.image_tag }}
97108
env:
98-
ARTIFACT_TAG: ${{ inputs.image_tag }}
99109
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
100110
if: inputs.ubuntu-noble

.github/workflows/stackhpc-promote.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ jobs:
4444
run: |
4545
echo "::notice Container image promote workflow: https://github.com/stackhpc/stackhpc-release-train/actions/workflows/container-promote.yml"
4646
47+
- name: Trigger overcloud host image promotion
48+
run: |
49+
gh workflow run \
50+
overcloud-host-image-promote.yml \
51+
--repo stackhpc/stackhpc-kayobe-config \
52+
--ref $BRANCH_NAME
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.STACKHPC_RELEASE_TRAIN_TOKEN }}
55+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
56+
57+
- name: Display link to overcloud host image promotion workflows
58+
run: |
59+
echo "::notice Overcloud host image promote workflow: https://github.com/stackhpc/stackhpc-kayobe-config/actions/workflows/overcloud-host-image-promote.yml"
60+
4761
- name: Send message to Slack via Workflow Builder
4862
uses: slackapi/[email protected]
4963
with:

.github/workflows/stackhpc-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
id: changes
3535
with:
3636
# Filters are defined in this file.
37-
filters: .github/path-filters.yml
37+
filters: .github/stackhpc-pull-request-path-filters.yml
3838

3939
tox:
4040
runs-on: ubuntu-24.04
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: Trigger overcloud host image build
3+
on:
4+
push:
5+
branches:
6+
- stackhpc/2025.1
7+
8+
jobs:
9+
check-changes:
10+
runs-on: ubuntu-24.04
11+
name: Check changed files
12+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
13+
outputs:
14+
pulp-repo-versions: ${{ steps.changes.outputs.pulp-repo-versions }}
15+
steps:
16+
- name: GitHub Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Check changed files
20+
uses: dorny/paths-filter@v3
21+
id: changes
22+
with:
23+
filters: .github/overcloud-host-image-build-path-filters.yml
24+
25+
trigger-overcloud-host-image-build:
26+
runs-on: ubuntu-24.04
27+
name: Trigger overcloud host image build
28+
needs:
29+
- check-changes
30+
if: ${{ needs.check-changes.outputs.pulp-repo-versions == 'true' }}
31+
steps:
32+
- name: Trigger overcloud host image build
33+
run: |
34+
gh workflow run \
35+
overcloud-host-image-build.yml \
36+
--repo stackhpc/stackhpc-kayobe-config \
37+
--ref $BRANCH_NAME
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
41+
42+
- name: Display link to overcloud host image build workflows
43+
run: |
44+
echo "::notice Overcloud host image build workflows: https://github.com/stackhpc/stackhpc-kayobe-config/actions/workflows/overcloud-host-image-build.yml"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: Update overcloud host image tags
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
rocky9_tag:
8+
description: Overcloud host image tag for Rocky 9
9+
type: string
10+
ubuntu_noble_tag:
11+
description: Overcloud host image tag for Ubuntu
12+
type: string
13+
14+
jobs:
15+
propose_overcloud_host_image_tag_updates:
16+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
17+
runs-on: ubuntu-22.04
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
name: Update overcloud host image tags
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
ref: stackhpc/2025.1
27+
path: ${{ github.workspace }}/src/kayobe-config
28+
29+
- name: Update Rocky 9 overcloud host image tag
30+
run: |
31+
sed -i "/stackhpc_rocky_9_overcloud_host_image_version/s/.*/stackhpc_rocky_9_overcloud_host_image_version: ${{ inputs.rocky9_tag }}/" ${{ github.workspace }}/src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml
32+
if: "${{ inputs.rocky9_tag != '' }}"
33+
34+
- name: Update Ubuntu Noble overcloud host image tag
35+
run: |
36+
sed -i "/stackhpc_ubuntu_noble_overcloud_host_image_version/s/.*/stackhpc_ubuntu_noble_overcloud_host_image_version: ${{ inputs.ubuntu_noble_tag }}/" ${{ github.workspace }}/src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml
37+
if: "${{ inputs.ubuntu_noble_tag != '' }}"
38+
39+
- name: Propose changes via PR if required
40+
uses: peter-evans/create-pull-request@v7
41+
with:
42+
path: ${{ github.workspace }}/src/kayobe-config
43+
commit-message: >-
44+
Bump overcloud host image tags
45+
author: stackhpc-ci <[email protected]>
46+
branch: bump-overcloud-host-images-${{ inputs.rocky9_tag }}-${{ inputs.ubuntu_noble_tag }}
47+
delete-branch: true
48+
title: >-
49+
Bump overcloud host image tags
50+
body: |
51+
This PR was created automatically to update the overcloud host image
52+
tags.
53+
Rocky 9: ${{ inputs.rocky9_tag }}
54+
Ubuntu Noble: ${{ inputs.ubuntu_noble_tag }}
55+
labels: |
56+
automated

0 commit comments

Comments
 (0)