Skip to content

Commit b38bff4

Browse files
committed
Only upload host images when required
1 parent 6302be7 commit b38bff4

File tree

1 file changed

+75
-35
lines changed

1 file changed

+75
-35
lines changed

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

Lines changed: 75 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ jobs:
9494
source venvs/kayobe/bin/activate &&
9595
pip install python-openstackclient -c https://opendev.org/openstack/requirements/raw/branch/stable/yoga/upper-constraints.txt
9696
97+
- name: Output CentOS Stream 8 image tag
98+
id: centos_8_stream_image_tag
99+
run: |
100+
echo image_tag=$(grep stackhpc_centos_8_stream_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
101+
102+
- name: Check if image exists already
103+
id: centos_8_stream_image_exists
104+
run: |
105+
source venvs/kayobe/bin/activate &&
106+
openstack image show \
107+
overcloud-centos-8-stream-${{ steps.centos_8_stream_image_tag.outputs.image_tag }}
108+
continue-on-error: true
109+
97110
- name: Download CentOS Stream 8 overcloud host image from Ark
98111
run: |
99112
source venvs/kayobe/bin/activate &&
@@ -104,12 +117,7 @@ jobs:
104117
-e os_release="8-stream"
105118
env:
106119
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
107-
if: inputs.centos
108-
109-
- name: Output CentOS Stream 8 image tag
110-
id: centos_8_stream_image_tag
111-
run: |
112-
echo image_tag=$(grep stackhpc_centos_8_stream_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
120+
if: inputs.centos && steps.centos_8_stream_image_exists.outcome == 'failure'
113121

114122
- name: Upload CentOS Stream 8 overcloud host image to Cloud
115123
run: |
@@ -125,7 +133,20 @@ jobs:
125133
OS_CLOUD: openstack
126134
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
127135
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
128-
if: inputs.centos
136+
if: inputs.centos && steps.centos_8_stream_image_exists.outcome == 'failure'
137+
138+
- name: Output Rocky Linux 8 image tag
139+
id: rocky_8_image_tag
140+
run: |
141+
echo image_tag=$(grep stackhpc_rocky_8_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
142+
143+
- name: Check if image exists already
144+
id: rocky_8_image_exists
145+
run: |
146+
source venvs/kayobe/bin/activate &&
147+
openstack image show \
148+
overcloud-rocky-8-${{ steps.rocky_8_image_tag.outputs.image_tag }}
149+
continue-on-error: true
129150

130151
- name: Download Rocky Linux 8 overcloud host image from Ark
131152
run: |
@@ -137,12 +158,7 @@ jobs:
137158
-e os_release="8"
138159
env:
139160
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
140-
if: inputs.rocky8
141-
142-
- name: Output Rocky Linux 8 image tag
143-
id: rocky_8_image_tag
144-
run: |
145-
echo image_tag=$(grep stackhpc_rocky_8_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
161+
if: inputs.rocky8 && steps.rocky_8_image_exists.outcome == 'failure'
146162

147163
- name: Upload Rocky Linux 8 overcloud host image to Cloud
148164
run: |
@@ -158,7 +174,20 @@ jobs:
158174
OS_CLOUD: openstack
159175
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
160176
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
161-
if: inputs.rocky8
177+
if: inputs.rocky8 && steps.rocky_8_image_exists.outcome == 'failure'
178+
179+
- name: Output Rocky Linux 9 image tag
180+
id: rocky_9_image_tag
181+
run: |
182+
echo image_tag=$(grep stackhpc_rocky_9_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
183+
184+
- name: Check if image exists already
185+
id: rocky_9_image_exists
186+
run: |
187+
source venvs/kayobe/bin/activate &&
188+
openstack image show \
189+
overcloud-rocky-9-${{ steps.rocky_9_image_tag.outputs.image_tag }}
190+
continue-on-error: true
162191

163192
- name: Download Rocky Linux 9 overcloud host image from Ark
164193
run: |
@@ -170,12 +199,7 @@ jobs:
170199
-e os_release="9"
171200
env:
172201
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
173-
if: inputs.rocky9
174-
175-
- name: Output Rocky Linux 9 image tag
176-
id: rocky_9_image_tag
177-
run: |
178-
echo image_tag=$(grep stackhpc_rocky_9_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
202+
if: inputs.rocky9 && steps.rocky_9_image_exists.outcome == 'failure'
179203

180204
- name: Upload Rocky Linux 9 overcloud host image to Cloud
181205
run: |
@@ -191,7 +215,20 @@ jobs:
191215
OS_CLOUD: openstack
192216
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
193217
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
194-
if: inputs.rocky9
218+
if: inputs.rocky9 && steps.rocky_9_image_exists.outcome == 'failure'
219+
220+
- name: Output Ubuntu Focal image tag
221+
id: ubuntu_focal_image_tag
222+
run: |
223+
echo image_tag=$(grep stackhpc_ubuntu_focal_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
224+
225+
- name: Check if image exists already
226+
id: ubuntu_focal_image_exists
227+
run: |
228+
source venvs/kayobe/bin/activate &&
229+
openstack image show \
230+
overcloud-ubuntu-focal-${{ steps.ubuntu_focal_image_tag.outputs.image_tag }}
231+
continue-on-error: true
195232

196233
- name: Download Ubuntu Focal 20.04 overcloud host image from Ark
197234
run: |
@@ -203,12 +240,7 @@ jobs:
203240
-e os_release="focal"
204241
env:
205242
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
206-
if: inputs.ubuntu-focal
207-
208-
- name: Output Ubuntu Focal image tag
209-
id: ubuntu_focal_image_tag
210-
run: |
211-
echo image_tag=$(grep stackhpc_ubuntu_focal_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
243+
if: inputs.ubuntu-focal && steps.ubuntu_focal_image_exists.outcome == 'failure'
212244

213245
- name: Upload Ubuntu Focal 20.04 overcloud host image to Cloud
214246
run: |
@@ -224,7 +256,20 @@ jobs:
224256
OS_CLOUD: openstack
225257
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
226258
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
227-
if: inputs.ubuntu-focal
259+
if: inputs.ubuntu-focal && steps.ubuntu_focal_image_exists.outcome == 'failure'
260+
261+
- name: Output Ubuntu Jammy image tag
262+
id: ubuntu_jammy_image_tag
263+
run: |
264+
echo image_tag=$(grep stackhpc_ubuntu_jammy_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
265+
266+
- name: Check if image exists already
267+
id: ubuntu_jammy_image_exists
268+
run: |
269+
source venvs/kayobe/bin/activate &&
270+
openstack image show \
271+
overcloud-ubuntu-jammy-${{ steps.ubuntu_jammy_image_tag.outputs.image_tag }}
272+
continue-on-error: true
228273

229274
- name: Download Ubuntu Jammy 22.04 overcloud host image from Ark
230275
run: |
@@ -236,12 +281,7 @@ jobs:
236281
-e os_release="jammy"
237282
env:
238283
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
239-
if: inputs.ubuntu-jammy
240-
241-
- name: Output Ubuntu Jammy image tag
242-
id: ubuntu_jammy_image_tag
243-
run: |
244-
echo image_tag=$(grep stackhpc_ubuntu_jammy_overcloud_host_image_version: src/kayobe-config/etc/kayobe/pulp-host-image-versions.yml | awk '{print $2}') >> $GITHUB_OUTPUT
284+
if: inputs.ubuntu-jammy && steps.ubuntu_jammy_image_exists.outcome == 'failure'
245285

246286
- name: Upload Ubuntu Jammy 22.04 overcloud host image to Cloud
247287
run: |
@@ -257,4 +297,4 @@ jobs:
257297
OS_CLOUD: openstack
258298
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
259299
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
260-
if: inputs.ubuntu-jammy
300+
if: inputs.ubuntu-jammy && steps.ubuntu_jammy_image_exists.outcome == 'failure'

0 commit comments

Comments
 (0)