Skip to content

Share built image with other projects #1631

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: stackhpc/2024.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/overcloud-host-image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ jobs:
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
HOST_IMAGE_BUILD_SHARE_PROJECT_ID: ${{ vars.HOST_IMAGE_BUILD_SHARE_PROJECT_ID }}
if: inputs.rocky9 && steps.build_rocky_9.outcome == 'success'

- name: Upload Rocky Linux 9 overcloud host image to other Dev Cloud (Leafcloud/SMS)
Expand All @@ -294,6 +295,7 @@ jobs:
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML_OTHER_CLOUD }}
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID_OTHER_CLOUD }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET_OTHER_CLOUD }}
HOST_IMAGE_BUILD_SHARE_PROJECT_ID: ${{ vars.HOST_IMAGE_BUILD_SHARE_PROJECT_ID_OTHER_CLOUD }}
if: inputs.rocky9 && steps.build_rocky_9.outcome == 'success'

- name: Build an Ubuntu Jammy 22.04 overcloud host image
Expand Down Expand Up @@ -348,6 +350,7 @@ jobs:
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
HOST_IMAGE_BUILD_SHARE_PROJECT_ID: ${{ vars.HOST_IMAGE_BUILD_SHARE_PROJECT_ID }}
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy.outcome == 'success'

- name: Upload Ubuntu Jammy overcloud host image to other Dev Cloud (Leafcloud/SMS)
Expand All @@ -362,6 +365,7 @@ jobs:
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML_OTHER_CLOUD }}
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID_OTHER_CLOUD }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET_OTHER_CLOUD }}
HOST_IMAGE_BUILD_SHARE_PROJECT_ID: ${{ vars.HOST_IMAGE_BUILD_SHARE_PROJECT_ID_OTHER_CLOUD }}
if: inputs.ubuntu-jammy && steps.build_ubuntu_jammy.outcome == 'success'

- name: Build an Ubuntu Noble 24.04 overcloud host image
Expand Down Expand Up @@ -416,6 +420,7 @@ jobs:
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML }}
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }}
HOST_IMAGE_BUILD_SHARE_PROJECT_ID: ${{ vars.HOST_IMAGE_BUILD_SHARE_PROJECT_ID }}
if: inputs.ubuntu-noble && steps.build_ubuntu_noble.outcome == 'success'

- name: Upload Ubuntu Noble overcloud host image to other Dev Cloud (Leafcloud/SMS)
Expand All @@ -430,6 +435,7 @@ jobs:
CLOUDS_YAML: ${{ secrets.CLOUDS_YAML_OTHER_CLOUD }}
OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID_OTHER_CLOUD }}
OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET_OTHER_CLOUD }}
HOST_IMAGE_BUILD_SHARE_PROJECT_ID: ${{ vars.HOST_IMAGE_BUILD_SHARE_PROJECT_ID_OTHER_CLOUD }}
if: inputs.ubuntu-noble && steps.build_ubuntu_noble.outcome == 'success'


Expand Down
15 changes: 15 additions & 0 deletions etc/kayobe/ansible/openstack-host-image-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@
disk_format: qcow2
state: present
filename: "{{ local_image_path }}"
visibility: shared
register: image

- name: Ensure dependencies are installed

Check failure on line 48 in etc/kayobe/ansible/openstack-host-image-upload.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.15 lint with Python 3.10

fqcn[action-core]

Use FQCN for builtin module actions (pip).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be integrated into the previous pip task here?

pip:

Check failure on line 49 in etc/kayobe/ansible/openstack-host-image-upload.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.16 lint with Python 3.12

fqcn[action-core]

Use FQCN for builtin module actions (pip).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pip:
ansible.builtin.pip:

name: python-openstackclient
virtualenv: "{{ ansible_python_interpreter | dirname | dirname }}"

# Add the image to the chosen project
- name: Add image to stackhpc-dev project

Check failure on line 54 in etc/kayobe/ansible/openstack-host-image-upload.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.15 lint with Python 3.10

fqcn[action-core]

Use FQCN for builtin module actions (command).
command: "{{ ansible_python_interpreter | dirname | dirname }}/bin/openstack image add project {{ image.image.id }} '{{ lookup('ansible.builtin.env', 'HOST_IMAGE_BUILD_SHARE_PROJECT_ID') }}'"

Check failure on line 55 in etc/kayobe/ansible/openstack-host-image-upload.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.16 lint with Python 3.12

fqcn[action-core]

Use FQCN for builtin module actions (command).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command: "{{ ansible_python_interpreter | dirname | dirname }}/bin/openstack image add project {{ image.image.id }} '{{ lookup('ansible.builtin.env', 'HOST_IMAGE_BUILD_SHARE_PROJECT_ID') }}'"
ansible.builtin.command: "{{ ansible_python_interpreter | dirname | dirname }}/bin/openstack image add project {{ image.image.id }} '{{ lookup('ansible.builtin.env', 'HOST_IMAGE_BUILD_SHARE_PROJECT_ID') }}'"


# Accept the image in the receiving project
- name: Accept image membership in stackhpc-dev project

Check failure on line 58 in etc/kayobe/ansible/openstack-host-image-upload.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.15 lint with Python 3.10

fqcn[action-core]

Use FQCN for builtin module actions (command).
command: "{{ ansible_python_interpreter | dirname | dirname }}/bin/openstack image set {{ image.image.id }} --project '{{ lookup('ansible.builtin.env', 'HOST_IMAGE_BUILD_SHARE_PROJECT_ID') }}' --accept"

Check failure on line 59 in etc/kayobe/ansible/openstack-host-image-upload.yml

View workflow job for this annotation

GitHub Actions / Ansible 2.16 lint with Python 3.12

fqcn[action-core]

Use FQCN for builtin module actions (command).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command: "{{ ansible_python_interpreter | dirname | dirname }}/bin/openstack image set {{ image.image.id }} --project '{{ lookup('ansible.builtin.env', 'HOST_IMAGE_BUILD_SHARE_PROJECT_ID') }}' --accept"
ansible.builtin.command: "{{ ansible_python_interpreter | dirname | dirname }}/bin/openstack image set {{ image.image.id }} --project '{{ lookup('ansible.builtin.env', 'HOST_IMAGE_BUILD_SHARE_PROJECT_ID') }}' --accept"


always:
- name: Remove clouds.yaml
Expand Down
Loading