Skip to content

Commit 056e98b

Browse files
committed
fatimage build now integrated into timestamp bump
1 parent 856541a commit 056e98b

File tree

2 files changed

+63
-8
lines changed

2 files changed

+63
-8
lines changed

.github/workflows/fatimage.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ on:
1010
- LEAFCLOUD
1111
- SMS
1212
- ARCUS
13+
workflow_call:
14+
inputs:
15+
ci_cloud:
16+
type: string
17+
default: LEAFCLOUD
18+
outputs:
19+
openhpc-RL8-image: ${{ steps.manifest.outputs.openhpc-RL8-image }}
20+
openhpc-RL9-image: ${{ steps.manifest.outputs.openhpc-RL9-image }}
1321

1422
jobs:
1523
openstack:
@@ -96,6 +104,7 @@ jobs:
96104
IMAGE_NAME=$(openstack image show -f value -c name $IMAGE_ID)
97105
echo "image-name=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
98106
echo "image-id=$IMAGE_ID" >> "$GITHUB_OUTPUT"
107+
echo "${{ matrix.build.image_name }}-image=${IMAGE_NAME}" >> "$GITHUB_OUTPUT"
99108
echo $IMAGE_ID > image-id.txt
100109
echo $IMAGE_NAME > image-name.txt
101110

.github/workflows/update-timestamps.yml

Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,60 @@ jobs:
1515
. venv/bin/activate
1616
. environments/.stackhpc/activate
1717
18+
- name: Switch to automation branch
19+
run: git checkout -b auto/bump-timestamps || git checkout auto/bump-timestamps
20+
1821
- name: Check for updated Ark timestamps and replace in defaults.yml
1922
run: ansible-playbook ansible/ci/update_timestamps.yml
2023

21-
- name: Create Pull Request
22-
uses: peter-evans/create-pull-request@v7
23-
with:
24-
add-paths: environments/common/inventory/group_vars/all/defaults.yml
25-
commit-message: "[automated] bumped repo timestamps to latest"
26-
branch: auto/bump-timestamps
27-
title: "[Automation] Bumped repo timestamps to latest"
28-
body: Automated changes by .github/workflows/update-timestamps.yml
24+
- name: Check if timestamps were changed
25+
id: timestamp_check
26+
run: |
27+
git diff --quiet
28+
echo "timestamps_changed=$?" >> "$GITHUB_OUTPUT"
29+
30+
# TODO: find way to stop CI running if pushing to existing PR
31+
- name: Push new timestamps
32+
if: "${{ steps.timestamp_check.outputs.timestamps_changed }} == 0"
33+
run: |
34+
git add environments/common/inventory/group_vars/all/defaults.yml
35+
git config user.name 'github-actions[bot]'
36+
git config user.email 'github-actions[bot]@users.noreply.github.com'
37+
git commit -m "Bumped repo timestamps"
38+
git push
39+
40+
build_fatimage:
41+
if: "${{ steps.timestamp_check.outputs.timestamps_changed }} == 0"
42+
needs: upstream_check
43+
uses: stackhpc/ansible-slurm-appliance/.github/workflows/fatimage.yml
44+
45+
ci_and_pr:
46+
if: "${{ steps.timestamp_check.outputs.timestamps_changed }} == 0"
47+
needs: build_fatimage
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v2
51+
52+
- name: Bump CI with new images
53+
run: |
54+
git checkout auto/bump-timestamps
55+
sed -i 's/"RL8".*$/"RL8": "${{ needs.build_fatimage.outputs.openhpc-RL8-image }}"/' environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
56+
sed -i 's/"RL9".*$/"RL9": "${{ needs.build_fatimage.outputs.openhpc-RL9-image }}"/' environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
57+
58+
- name: Push new images
59+
run: |
60+
git add environments/.stackhpc/terraform/cluster_image.auto.tfvars.json
61+
git config user.name 'github-actions[bot]'
62+
git config user.email 'github-actions[bot]@users.noreply.github.com'
63+
git commit -m "Bumped images"
64+
git push
65+
66+
- name: Check if PR exists
67+
id: pr-check
68+
run: |
69+
gh pr list --json headRefName --jq '.[].headRefName' | grep auto/bump-timestamps
70+
echo "pr_exists=$?" >> "$GITHUB_OUTPUT"
71+
72+
- name: Create PR
73+
if: ${{ steps.pr-check.outputs.pr_exists }}
74+
run: gh pr create --title "[Auto] Bump repo timestamps to latest" --base main --head auto/bump-timestamps

0 commit comments

Comments
 (0)