From 598f4de20713e3392364f830859db35ba0746fdd Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Fri, 29 Nov 2024 10:36:37 +0000 Subject: [PATCH 01/10] Generalise image upload playbook --- .github/workflows/overcloud-host-image-build.yml | 14 +++++++------- etc/kayobe/ansible/pulp-host-image-upload.yml | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index ee106cc5f..577ef505f 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -66,13 +66,13 @@ jobs: # Generate a tag to apply to all built overcloud host images. - name: Generate overcloud host image tag - id: host_image_tag + id: image_tag run: | - echo "host_image_tag=$(date +${{ steps.openstack_release.outputs.openstack_release }}-%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT + echo "image_tag=$(date +${{ steps.openstack_release.outputs.openstack_release }}-%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT - name: Display overcloud host image tag run: | - echo "${{ steps.host_image_tag.outputs.host_image_tag }}" + echo "${{ steps.image_tag.outputs.image_tag }}" - name: Install Kayobe run: | @@ -241,7 +241,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-rocky-9 \ - -e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e image_tag=${{ steps.image_tag.outputs.image_tag }} \ -e os_distribution="rocky" \ -e os_release="9" env: @@ -255,7 +255,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \ -e local_image_path="/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.qcow2" \ - -e image_name=overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }} + -e image_name=overcloud-rocky-9-${{ steps.image_tag.outputs.image_tag }} env: CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }} OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} @@ -293,7 +293,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ - -e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e image_tag=${{ steps.image_tag.outputs.image_tag }} \ -e os_distribution="ubuntu" \ -e os_release="jammy" env: @@ -307,7 +307,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \ -e local_image_path="/opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.qcow2" \ - -e image_name=overcloud-ubuntu-jammy-${{ steps.host_image_tag.outputs.host_image_tag }} + -e image_name=overcloud-ubuntu-jammy-${{ steps.image_tag.outputs.image_tag }} env: CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }} OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} diff --git a/etc/kayobe/ansible/pulp-host-image-upload.yml b/etc/kayobe/ansible/pulp-host-image-upload.yml index cc4876080..5b83f4c0b 100644 --- a/etc/kayobe/ansible/pulp-host-image-upload.yml +++ b/etc/kayobe/ansible/pulp-host-image-upload.yml @@ -10,7 +10,7 @@ tasks: - name: Print image tag debug: - msg: "Image tag: {{ host_image_tag }}" + msg: "Image tag: {{ image_tag }}" - name: Get filename find: @@ -107,8 +107,8 @@ pulp_url: "{{ remote_pulp_url }}" username: "{{ remote_pulp_username }}" password: "{{ remote_pulp_password }}" - name: "{{ repository_name }}_{{ host_image_tag }}" - base_path: "{{ pulp_base_path }}/{{ host_image_tag }}" + name: "{{ repository_name }}_{{ image_tag }}" + base_path: "{{ pulp_base_path }}/{{ image_tag }}" publication: "{{ publication_details.publication.pulp_href }}" content_guard: development state: present @@ -122,7 +122,7 @@ lineinfile: path: /tmp/updated_images.txt line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\ - {{ host_image_tag }}/{{ found_files.files[0].path | basename }}" + {{ image_tag }}/{{ found_files.files[0].path | basename }}" create: true - name: Update new images file with latest path @@ -135,7 +135,7 @@ - name: Print versioned path debug: msg: "New versioned path: {{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\ - {{ host_image_tag }}/{{ found_files.files[0].path | basename }}" + {{ image_tag }}/{{ found_files.files[0].path | basename }}" when: latest_distribution_details.changed - name: Print latest path @@ -146,5 +146,5 @@ - name: Print version tag debug: - msg: "New tag: {{ host_image_tag }}" + msg: "New tag: {{ image_tag }}" when: latest_distribution_details.changed From 9f5d9345b65b7d0f9047394453a2525b71339ba9 Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Fri, 29 Nov 2024 10:40:17 +0000 Subject: [PATCH 02/10] Replace occurences to host-image --- .github/workflows/overcloud-host-image-build.yml | 4 ++-- .../{pulp-host-image-upload.yml => pulp-image-upload.yml} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename etc/kayobe/ansible/{pulp-host-image-upload.yml => pulp-image-upload.yml} (100%) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index 577ef505f..861eda634 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -239,7 +239,7 @@ jobs: source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && kayobe playbook run \ - src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \ + src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-rocky-9 \ -e image_tag=${{ steps.image_tag.outputs.image_tag }} \ -e os_distribution="rocky" \ @@ -291,7 +291,7 @@ jobs: source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && kayobe playbook run \ - src/kayobe-config/etc/kayobe/ansible/pulp-host-image-upload.yml \ + src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ -e image_tag=${{ steps.image_tag.outputs.image_tag }} \ -e os_distribution="ubuntu" \ diff --git a/etc/kayobe/ansible/pulp-host-image-upload.yml b/etc/kayobe/ansible/pulp-image-upload.yml similarity index 100% rename from etc/kayobe/ansible/pulp-host-image-upload.yml rename to etc/kayobe/ansible/pulp-image-upload.yml From d472c33e181ad916a0dfaecfe8204177a2581355 Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Fri, 29 Nov 2024 10:46:50 +0000 Subject: [PATCH 03/10] Variable for file extension --- etc/kayobe/ansible/pulp-image-upload.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/kayobe/ansible/pulp-image-upload.yml b/etc/kayobe/ansible/pulp-image-upload.yml index 5b83f4c0b..3144e03c0 100644 --- a/etc/kayobe/ansible/pulp-image-upload.yml +++ b/etc/kayobe/ansible/pulp-image-upload.yml @@ -7,6 +7,7 @@ remote_pulp_password: "{{ stackhpc_image_repository_password }}" repository_name: "kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" pulp_base_path: "kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" + file_extension: '*.qcow2' tasks: - name: Print image tag debug: @@ -15,7 +16,7 @@ - name: Get filename find: paths: "{{ image_path }}" - patterns: '*.qcow2' + patterns: "{{ file_extension }}" register: found_files - name: Upload an artifact From 3198fcedf0f0e2f66097cc2c879d36d3cc15e841 Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Fri, 29 Nov 2024 15:26:22 +0000 Subject: [PATCH 04/10] Revert changes to overcloud image build --- .github/workflows/overcloud-host-image-build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index 861eda634..f45524758 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -66,13 +66,13 @@ jobs: # Generate a tag to apply to all built overcloud host images. - name: Generate overcloud host image tag - id: image_tag + id: host_image_tag run: | - echo "image_tag=$(date +${{ steps.openstack_release.outputs.openstack_release }}-%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT + echo "host_image_tag=$(date +${{ steps.openstack_release.outputs.openstack_release }}-%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT - name: Display overcloud host image tag run: | - echo "${{ steps.image_tag.outputs.image_tag }}" + echo "${{ steps.host_image_tag.outputs.host_image_tag }}" - name: Install Kayobe run: | @@ -241,7 +241,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-rocky-9 \ - -e image_tag=${{ steps.image_tag.outputs.image_tag }} \ + -e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ -e os_distribution="rocky" \ -e os_release="9" env: @@ -255,7 +255,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \ -e local_image_path="/opt/kayobe/images/overcloud-rocky-9/overcloud-rocky-9.qcow2" \ - -e image_name=overcloud-rocky-9-${{ steps.image_tag.outputs.image_tag }} + -e image_name=overcloud-rocky-9-${{ steps.host_image_tag.outputs.host_image_tag }} env: CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }} OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} @@ -293,7 +293,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ - -e image_tag=${{ steps.image_tag.outputs.image_tag }} \ + -e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ -e os_distribution="ubuntu" \ -e os_release="jammy" env: @@ -307,7 +307,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/openstack-host-image-upload.yml \ -e local_image_path="/opt/kayobe/images/overcloud-ubuntu-jammy/overcloud-ubuntu-jammy.qcow2" \ - -e image_name=overcloud-ubuntu-jammy-${{ steps.image_tag.outputs.image_tag }} + -e image_name=overcloud-ubuntu-jammy-${{ steps.host_image_tag.outputs.host_image_tag }} env: CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }} OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} From a34f9278ad9ff472b45d8dea03f76c98141df44e Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Tue, 3 Dec 2024 12:40:51 +0000 Subject: [PATCH 05/10] Update file extension variable --- .github/workflows/overcloud-host-image-build.yml | 4 ++-- etc/kayobe/ansible/pulp-image-upload.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index f45524758..47ec3ffd0 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -241,7 +241,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-rocky-9 \ - -e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ -e os_distribution="rocky" \ -e os_release="9" env: @@ -293,7 +293,7 @@ jobs: kayobe playbook run \ src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ - -e host_image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ -e os_distribution="ubuntu" \ -e os_release="jammy" env: diff --git a/etc/kayobe/ansible/pulp-image-upload.yml b/etc/kayobe/ansible/pulp-image-upload.yml index 3144e03c0..2b032b256 100644 --- a/etc/kayobe/ansible/pulp-image-upload.yml +++ b/etc/kayobe/ansible/pulp-image-upload.yml @@ -7,7 +7,7 @@ remote_pulp_password: "{{ stackhpc_image_repository_password }}" repository_name: "kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" pulp_base_path: "kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" - file_extension: '*.qcow2' + file_extension: 'qcow2' tasks: - name: Print image tag debug: @@ -16,7 +16,7 @@ - name: Get filename find: paths: "{{ image_path }}" - patterns: "{{ file_extension }}" + patterns: "*.{{ file_extension }}" register: found_files - name: Upload an artifact From b993c1a079c677cae9855f493f23086827ccad25 Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Tue, 3 Dec 2024 12:53:12 +0000 Subject: [PATCH 06/10] Use image name --- .github/workflows/overcloud-host-image-build.yml | 2 ++ etc/kayobe/ansible/pulp-image-upload.yml | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index 47ec3ffd0..cb365d214 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -242,6 +242,7 @@ jobs: src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-rocky-9 \ -e image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e image_name="kayobe-images" \ -e os_distribution="rocky" \ -e os_release="9" env: @@ -294,6 +295,7 @@ jobs: src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ -e image_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ -e image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e image_name="kayobe-images" \ -e os_distribution="ubuntu" \ -e os_release="jammy" env: diff --git a/etc/kayobe/ansible/pulp-image-upload.yml b/etc/kayobe/ansible/pulp-image-upload.yml index 2b032b256..827c9d5a5 100644 --- a/etc/kayobe/ansible/pulp-image-upload.yml +++ b/etc/kayobe/ansible/pulp-image-upload.yml @@ -5,8 +5,8 @@ remote_pulp_url: "{{ stackhpc_release_pulp_url }}" remote_pulp_username: "{{ stackhpc_image_repository_username }}" remote_pulp_password: "{{ stackhpc_image_repository_password }}" - repository_name: "kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" - pulp_base_path: "kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" + repository_name: "{{ image_name }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" + pulp_base_path: "{{ image_name }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" file_extension: 'qcow2' tasks: - name: Print image tag From 24f08f078ab8942ae56a421757cd105ed5b299b6 Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Tue, 3 Dec 2024 15:25:38 +0000 Subject: [PATCH 07/10] s/image/artifact/g --- etc/kayobe/ansible/pulp-image-upload.yml | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/etc/kayobe/ansible/pulp-image-upload.yml b/etc/kayobe/ansible/pulp-image-upload.yml index 827c9d5a5..18079da9a 100644 --- a/etc/kayobe/ansible/pulp-image-upload.yml +++ b/etc/kayobe/ansible/pulp-image-upload.yml @@ -1,21 +1,21 @@ --- -- name: Upload and create a distribution for an image +- name: Upload and create a distribution for an artifact hosts: seed vars: remote_pulp_url: "{{ stackhpc_release_pulp_url }}" remote_pulp_username: "{{ stackhpc_image_repository_username }}" remote_pulp_password: "{{ stackhpc_image_repository_password }}" - repository_name: "{{ image_name }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" - pulp_base_path: "{{ image_name }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" + repository_name: "{{ artifact_path }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" + pulp_base_path: "{{ artifact_path }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" file_extension: 'qcow2' tasks: - - name: Print image tag + - name: Print artifact tag debug: - msg: "Image tag: {{ image_tag }}" + msg: "artifact tag: {{ artifact_tag }}" - name: Get filename find: - paths: "{{ image_path }}" + paths: "{{ artifact_path }}" patterns: "*.{{ file_extension }}" register: found_files @@ -108,8 +108,8 @@ pulp_url: "{{ remote_pulp_url }}" username: "{{ remote_pulp_username }}" password: "{{ remote_pulp_password }}" - name: "{{ repository_name }}_{{ image_tag }}" - base_path: "{{ pulp_base_path }}/{{ image_tag }}" + name: "{{ repository_name }}_{{ artifact_tag }}" + base_path: "{{ pulp_base_path }}/{{ artifact_tag }}" publication: "{{ publication_details.publication.pulp_href }}" content_guard: development state: present @@ -119,16 +119,16 @@ retries: 3 delay: 5 - - name: Update new images file with versioned path + - name: Update new artifacts file with versioned path lineinfile: - path: /tmp/updated_images.txt + path: /tmp/updated_artifacts.txt line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\ - {{ image_tag }}/{{ found_files.files[0].path | basename }}" + {{ artifact_tag }}/{{ found_files.files[0].path | basename }}" create: true - - name: Update new images file with latest path + - name: Update new artifacts file with latest path lineinfile: - path: /tmp/updated_images.txt + path: /tmp/updated_artifacts.txt line: "{{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\ latest/{{ found_files.files[0].path | basename }}" when: latest_distribution_details.changed @@ -136,7 +136,7 @@ - name: Print versioned path debug: msg: "New versioned path: {{ remote_pulp_url }}/pulp/content/{{ pulp_base_path }}/\ - {{ image_tag }}/{{ found_files.files[0].path | basename }}" + {{ artifact_tag }}/{{ found_files.files[0].path | basename }}" when: latest_distribution_details.changed - name: Print latest path @@ -147,5 +147,5 @@ - name: Print version tag debug: - msg: "New tag: {{ image_tag }}" + msg: "New tag: {{ artifact_tag }}" when: latest_distribution_details.changed From 0f223566627ef9d7e7026963c5287d27ec84d67e Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Tue, 3 Dec 2024 16:17:29 +0000 Subject: [PATCH 08/10] Remove image_repository creds --- etc/kayobe/ansible/pulp-host-image-download.yml | 4 ++-- etc/kayobe/ansible/pulp-host-image-promote.yml | 4 ++-- etc/kayobe/ansible/pulp-image-upload.yml | 4 ++-- etc/kayobe/environments/ci-builder/stackhpc-ci.yml | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/kayobe/ansible/pulp-host-image-download.yml b/etc/kayobe/ansible/pulp-host-image-download.yml index 6b3494dfe..91fab9052 100644 --- a/etc/kayobe/ansible/pulp-host-image-download.yml +++ b/etc/kayobe/ansible/pulp-host-image-download.yml @@ -25,8 +25,8 @@ - name: Download image artifact get_url: url: "{{ stackhpc_overcloud_host_image_url_no_auth }}" - username: "{{ stackhpc_image_repository_username }}" - password: "{{ stackhpc_image_repository_password }}" + username: "{{ stackhpc_release_pulp_username }}" + password: "{{ stackhpc_release_pulp_password }}" force_basic_auth: true unredirected_headers: - "Authorization" diff --git a/etc/kayobe/ansible/pulp-host-image-promote.yml b/etc/kayobe/ansible/pulp-host-image-promote.yml index 42f98b423..f7b0a0607 100644 --- a/etc/kayobe/ansible/pulp-host-image-promote.yml +++ b/etc/kayobe/ansible/pulp-host-image-promote.yml @@ -4,8 +4,8 @@ hosts: localhost vars: remote_pulp_url: "{{ stackhpc_release_pulp_url }}" - remote_pulp_username: "{{ stackhpc_image_repository_username }}" - remote_pulp_password: "{{ stackhpc_image_repository_password }}" + remote_pulp_username: "{{ stackhpc_release_pulp_username }}" + remote_pulp_password: "{{ stackhpc_release_pulp_password }}" repository_name: "kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" base_path: "kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" promotion_tag: "{{ lookup('env', 'OVERCLOUD_HOST_IMAGE_TAG') }}" diff --git a/etc/kayobe/ansible/pulp-image-upload.yml b/etc/kayobe/ansible/pulp-image-upload.yml index 18079da9a..19be5f584 100644 --- a/etc/kayobe/ansible/pulp-image-upload.yml +++ b/etc/kayobe/ansible/pulp-image-upload.yml @@ -3,8 +3,8 @@ hosts: seed vars: remote_pulp_url: "{{ stackhpc_release_pulp_url }}" - remote_pulp_username: "{{ stackhpc_image_repository_username }}" - remote_pulp_password: "{{ stackhpc_image_repository_password }}" + remote_pulp_username: "{{ stackhpc_release_pulp_username }}" + remote_pulp_password: "{{ stackhpc_release_pulp_password }}" repository_name: "{{ artifact_path }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" pulp_base_path: "{{ artifact_path }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" file_extension: 'qcow2' diff --git a/etc/kayobe/environments/ci-builder/stackhpc-ci.yml b/etc/kayobe/environments/ci-builder/stackhpc-ci.yml index 338b7ef66..22258a838 100644 --- a/etc/kayobe/environments/ci-builder/stackhpc-ci.yml +++ b/etc/kayobe/environments/ci-builder/stackhpc-ci.yml @@ -94,5 +94,5 @@ stackhpc_docker_registry_password: !vault | 3664 # Username and password of the overcloud host image repository. -stackhpc_image_repository_username: "{{ stackhpc_docker_registry_username }}" -stackhpc_image_repository_password: "{{ stackhpc_docker_registry_password }}" +stackhpc_release_pulp_username: "{{ stackhpc_docker_registry_username }}" +stackhpc_release_pulp_password: "{{ stackhpc_docker_registry_password }}" From 09e1d2f3635dc84e81b9e08b73e33351c6de75e1 Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Wed, 4 Dec 2024 11:55:24 +0000 Subject: [PATCH 09/10] Fix artifact references in host-image-build --- .../workflows/overcloud-host-image-build.yml | 18 ++++++++++-------- ...age-upload.yml => pulp-artifact-upload.yml} | 7 +++---- 2 files changed, 13 insertions(+), 12 deletions(-) rename etc/kayobe/ansible/{pulp-image-upload.yml => pulp-artifact-upload.yml} (96%) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index cb365d214..942d76fd0 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -239,10 +239,11 @@ jobs: source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && kayobe playbook run \ - src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ - -e image_path=/opt/kayobe/images/overcloud-rocky-9 \ - -e image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ - -e image_name="kayobe-images" \ + src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \ + -e artifact_path=/opt/kayobe/images/overcloud-rocky-9 \ + -e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e artifact_name="kayobe-images" \ + -e file_regex="*.qcow2" \ -e os_distribution="rocky" \ -e os_release="9" env: @@ -292,10 +293,11 @@ jobs: source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && kayobe playbook run \ - src/kayobe-config/etc/kayobe/ansible/pulp-image-upload.yml \ - -e image_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ - -e image_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ - -e image_name="kayobe-images" \ + src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \ + -e artifact_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ + -e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ + -e artifact_name="kayobe-images" \ + -e file_regex="*.qcow2" \ -e os_distribution="ubuntu" \ -e os_release="jammy" env: diff --git a/etc/kayobe/ansible/pulp-image-upload.yml b/etc/kayobe/ansible/pulp-artifact-upload.yml similarity index 96% rename from etc/kayobe/ansible/pulp-image-upload.yml rename to etc/kayobe/ansible/pulp-artifact-upload.yml index 19be5f584..0d696e294 100644 --- a/etc/kayobe/ansible/pulp-image-upload.yml +++ b/etc/kayobe/ansible/pulp-artifact-upload.yml @@ -5,9 +5,8 @@ remote_pulp_url: "{{ stackhpc_release_pulp_url }}" remote_pulp_username: "{{ stackhpc_release_pulp_username }}" remote_pulp_password: "{{ stackhpc_release_pulp_password }}" - repository_name: "{{ artifact_path }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" - pulp_base_path: "{{ artifact_path }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" - file_extension: 'qcow2' + repository_name: "{{ artifact_name }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" + pulp_base_path: "{{ artifact_name }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" tasks: - name: Print artifact tag debug: @@ -16,7 +15,7 @@ - name: Get filename find: paths: "{{ artifact_path }}" - patterns: "*.{{ file_extension }}" + patterns: "{{ file_regex }}" register: found_files - name: Upload an artifact From 664241a00edaba9d9e22f859dee494433e780de2 Mon Sep 17 00:00:00 2001 From: Jake Hutchinson Date: Wed, 4 Dec 2024 14:59:31 +0000 Subject: [PATCH 10/10] Generalise promotion workflow --- .../workflows/overcloud-host-image-build.yml | 4 ++-- .../overcloud-host-image-promote.yml | 12 +++++------ ...-promote.yml => pulp-artifact-promote.yml} | 21 +++++++++---------- etc/kayobe/ansible/pulp-artifact-upload.yml | 4 ++-- 4 files changed, 20 insertions(+), 21 deletions(-) rename etc/kayobe/ansible/{pulp-host-image-promote.yml => pulp-artifact-promote.yml} (63%) diff --git a/.github/workflows/overcloud-host-image-build.yml b/.github/workflows/overcloud-host-image-build.yml index 942d76fd0..215452cf2 100644 --- a/.github/workflows/overcloud-host-image-build.yml +++ b/.github/workflows/overcloud-host-image-build.yml @@ -242,7 +242,7 @@ jobs: src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \ -e artifact_path=/opt/kayobe/images/overcloud-rocky-9 \ -e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ - -e artifact_name="kayobe-images" \ + -e artifact_type="kayobe-images" \ -e file_regex="*.qcow2" \ -e os_distribution="rocky" \ -e os_release="9" @@ -296,7 +296,7 @@ jobs: src/kayobe-config/etc/kayobe/ansible/pulp-artifact-upload.yml \ -e artifact_path=/opt/kayobe/images/overcloud-ubuntu-jammy \ -e artifact_tag=${{ steps.host_image_tag.outputs.host_image_tag }} \ - -e artifact_name="kayobe-images" \ + -e artifact_type="kayobe-images" \ -e file_regex="*.qcow2" \ -e os_distribution="ubuntu" \ -e os_release="jammy" diff --git a/.github/workflows/overcloud-host-image-promote.yml b/.github/workflows/overcloud-host-image-promote.yml index 7b06b90d7..f6e167d45 100644 --- a/.github/workflows/overcloud-host-image-promote.yml +++ b/.github/workflows/overcloud-host-image-promote.yml @@ -76,12 +76,12 @@ jobs: source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && kayobe playbook run \ - src/kayobe-config/etc/kayobe/ansible/pulp-host-image-promote.yml \ - -e image_path='/opt/kayobe/images/overcloud-rocky-linux-9' \ + src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \ + -e artifact_type="kayobe-images" \ -e os_distribution='rocky' \ -e os_release='9' env: - OVERCLOUD_HOST_IMAGE_TAG: ${{ inputs.image_tag }} + ARTIFACT_TAG: ${{ inputs.image_tag }} KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} if: inputs.rocky9 @@ -90,11 +90,11 @@ jobs: source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && kayobe playbook run \ - src/kayobe-config/etc/kayobe/ansible/pulp-host-image-promote.yml \ - -e image_path='/opt/kayobe/images/overcloud-ubuntu-jammy' \ + src/kayobe-config/etc/kayobe/ansible/pulp-artifact-promote.yml \ + -e artifact_type="kayobe-images" \ -e os_distribution='ubuntu' \ -e os_release='jammy' env: - OVERCLOUD_HOST_IMAGE_TAG: ${{ inputs.image_tag }} + ARTIFACT_TAG: ${{ inputs.image_tag }} KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} if: inputs.ubuntu-jammy diff --git a/etc/kayobe/ansible/pulp-host-image-promote.yml b/etc/kayobe/ansible/pulp-artifact-promote.yml similarity index 63% rename from etc/kayobe/ansible/pulp-host-image-promote.yml rename to etc/kayobe/ansible/pulp-artifact-promote.yml index f7b0a0607..1960d199a 100644 --- a/etc/kayobe/ansible/pulp-host-image-promote.yml +++ b/etc/kayobe/ansible/pulp-artifact-promote.yml @@ -1,31 +1,30 @@ --- -# Tag is the version of the image to promote, stored in an env variable named OVERCLOUD_HOST_IMAGE_TAG -- name: Promote an image to production +# Tag is the version of the artifact to promote, stored in an env variable named ARTIFACT_TAG +- name: Promote an artifact to production hosts: localhost vars: remote_pulp_url: "{{ stackhpc_release_pulp_url }}" remote_pulp_username: "{{ stackhpc_release_pulp_username }}" remote_pulp_password: "{{ stackhpc_release_pulp_password }}" - repository_name: "kayobe-images-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" - base_path: "kayobe-images/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" - promotion_tag: "{{ lookup('env', 'OVERCLOUD_HOST_IMAGE_TAG') }}" + repository_name: "{{ artifact_type }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" + pulp_base_path: "{{ artifact_type }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" + promotion_tag: "{{ lookup('env', 'ARTIFACT_TAG') }}" tasks: - - - name: Check whether the image exists + - name: Check whether the artifact exists pulp.squeezer.file_distribution: pulp_url: "{{ remote_pulp_url }}" username: "{{ remote_pulp_username }}" password: "{{ remote_pulp_password }}" name: "{{ repository_name }}_{{ promotion_tag }}" - base_path: "{{ base_path }}/{{ promotion_tag }}" + base_path: "{{ pulp_base_path }}/{{ promotion_tag }}" register: distribution_details until: distribution_details is success retries: 3 delay: 5 - - name: Fail if the image does not exist + - name: Fail if the artifact does not exist fail: - msg: "Image {{ promotion_tag }} does not exist" + msg: "artifact {{ promotion_tag }} does not exist" when: distribution_details.distribution is none - name: Ensure production content guard is set @@ -34,7 +33,7 @@ username: "{{ remote_pulp_username }}" password: "{{ remote_pulp_password }}" name: "{{ repository_name }}_{{ promotion_tag }}" - base_path: "{{ base_path }}/{{ promotion_tag }}" + base_path: "{{ pulp_base_path }}/{{ promotion_tag }}" content_guard: release state: present register: content_guard_result diff --git a/etc/kayobe/ansible/pulp-artifact-upload.yml b/etc/kayobe/ansible/pulp-artifact-upload.yml index 0d696e294..bbec22099 100644 --- a/etc/kayobe/ansible/pulp-artifact-upload.yml +++ b/etc/kayobe/ansible/pulp-artifact-upload.yml @@ -5,8 +5,8 @@ remote_pulp_url: "{{ stackhpc_release_pulp_url }}" remote_pulp_username: "{{ stackhpc_release_pulp_username }}" remote_pulp_password: "{{ stackhpc_release_pulp_password }}" - repository_name: "{{ artifact_name }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" - pulp_base_path: "{{ artifact_name }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" + repository_name: "{{ artifact_type }}-{{ openstack_release }}-{{ os_distribution }}-{{ os_release }}" + pulp_base_path: "{{ artifact_type }}/{{ openstack_release }}/{{ os_distribution }}/{{ os_release }}" tasks: - name: Print artifact tag debug: