Skip to content

Commit 664241a

Browse files
Generalise promotion workflow
1 parent 09e1d2f commit 664241a

File tree

4 files changed

+20
-21
lines changed

4 files changed

+20
-21
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ jobs:
242242
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
243243
-e artifact_path=/opt/kayobe/images/overcloud-rocky-9 \
244244
-e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
245-
-e artifact_name="kayobe-images" \
245+
-e artifact_type="kayobe-images" \
246246
-e file_regex="*.qcow2" \
247247
-e os_distribution="rocky" \
248248
-e os_release="9"
@@ -296,7 +296,7 @@ jobs:
296296
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \
297297
-e artifact_path=/opt/kayobe/images/overcloud-ubuntu-jammy \
298298
-e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \
299-
-e artifact_name="kayobe-images" \
299+
-e artifact_type="kayobe-images" \
300300
-e file_regex="*.qcow2" \
301301
-e os_distribution="ubuntu" \
302302
-e os_release="jammy"

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ jobs:
7676
source venvs/kayobe/bin/activate &&
7777
source src/kayobe-config/kayobe-env --environment ci-builder &&
7878
kayobe playbook run \
79-
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-promote.yml \
80-
-e image_path='/opt/kayobe/images/overcloud-rocky-linux-9' \
79+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \
80+
-e artifact_type="kayobe-images" \
8181
-e os_distribution='rocky' \
8282
-e os_release='9'
8383
env:
84-
OVERCLOUD_HOST_IMAGE_TAG: ${{ inputs.image_tag }}
84+
ARTIFACT_TAG: ${{ inputs.image_tag }}
8585
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
8686
if: inputs.rocky9
8787

@@ -90,11 +90,11 @@ jobs:
9090
source venvs/kayobe/bin/activate &&
9191
source src/kayobe-config/kayobe-env --environment ci-builder &&
9292
kayobe playbook run \
93-
src/kayobe-config/etc/kayobe/ansible/pulp-host-image-promote.yml \
94-
-e image_path='/opt/kayobe/images/overcloud-ubuntu-jammy' \
93+
src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \
94+
-e artifact_type="kayobe-images" \
9595
-e os_distribution='ubuntu' \
9696
-e os_release='jammy'
9797
env:
98-
OVERCLOUD_HOST_IMAGE_TAG: ${{ inputs.image_tag }}
98+
ARTIFACT_TAG: ${{ inputs.image_tag }}
9999
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
100100
if: inputs.ubuntu-jammy

etc/kayobe/ansible/pulp-host-image-promote.yml renamed to etc/kayobe/ansible/pulp-artifact-promote.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
---
2-
# Tag is the version of the image to promote, stored in an env variable named OVERCLOUD_HOST_IMAGE_TAG
3-
- name: Promote an image to production
2+
# Tag is the version of the artifact to promote, stored in an env variable named ARTIFACT_TAG
3+
- name: Promote an artifact to production
44
hosts: localhost
55
vars:
66
remote_pulp_url: "{{ stackhpc_release_pulp_url }}"
77
remote_pulp_username: "{{ stackhpc_release_pulp_username }}"
88
remote_pulp_password: "{{ stackhpc_release_pulp_password }}"
9-
repository_name: "kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}"
10-
base_path: "kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}"
11-
promotion_tag: "{{ lookup('env', 'OVERCLOUD_HOST_IMAGE_TAG') }}"
9+
repository_name: "{{ artifact_type }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}"
10+
pulp_base_path: "{{ artifact_type }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}"
11+
promotion_tag: "{{ lookup('env', 'ARTIFACT_TAG') }}"
1212
tasks:
13-
14-
- name: Check whether the image exists
13+
- name: Check whether the artifact exists
1514
pulp.squeezer.file_distribution:
1615
pulp_url: "{{ remote_pulp_url }}"
1716
username: "{{ remote_pulp_username }}"
1817
password: "{{ remote_pulp_password }}"
1918
name: "{{ repository_name }}_{{ promotion_tag }}"
20-
base_path: "{{ base_path }}/{{ promotion_tag }}"
19+
base_path: "{{ pulp_base_path }}/{{ promotion_tag }}"
2120
register: distribution_details
2221
until: distribution_details is success
2322
retries: 3
2423
delay: 5
2524

26-
- name: Fail if the image does not exist
25+
- name: Fail if the artifact does not exist
2726
fail:
28-
msg: "Image {{ promotion_tag }} does not exist"
27+
msg: "artifact {{ promotion_tag }} does not exist"
2928
when: distribution_details.distribution is none
3029

3130
- name: Ensure production content guard is set
@@ -34,7 +33,7 @@
3433
username: "{{ remote_pulp_username }}"
3534
password: "{{ remote_pulp_password }}"
3635
name: "{{ repository_name }}_{{ promotion_tag }}"
37-
base_path: "{{ base_path }}/{{ promotion_tag }}"
36+
base_path: "{{ pulp_base_path }}/{{ promotion_tag }}"
3837
content_guard: release
3938
state: present
4039
register: content_guard_result

etc/kayobe/ansible/pulp-artifact-upload.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
remote_pulp_url: "{{ stackhpc_release_pulp_url }}"
66
remote_pulp_username: "{{ stackhpc_release_pulp_username }}"
77
remote_pulp_password: "{{ stackhpc_release_pulp_password }}"
8-
repository_name: "{{ artifact_name }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}"
9-
pulp_base_path: "{{ artifact_name }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}"
8+
repository_name: "{{ artifact_type }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}"
9+
pulp_base_path: "{{ artifact_type }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}"
1010
tasks:
1111
- name: Print artifact tag
1212
debug:

0 commit comments

Comments
 (0)