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

Conversation

MaxBed4d
Copy link
Contributor

@MaxBed4d MaxBed4d commented May 1, 2025

In addition to uploading the image to both SMS and LeafCloud this PR enables the images to be shared between the current CI Project and the project ID provided as environment variables HOST_IMAGE_BUILD_SHARE_PROJECT_ID & HOST_IMAGE_BUILD_SHARE_PROJECT_ID_OTHER_CLOUD.

@MaxBed4d MaxBed4d requested a review from Alex-Welsh May 1, 2025 12:34
@MaxBed4d MaxBed4d requested a review from a team as a code owner May 1, 2025 12:34
@product-auto-label product-auto-label bot added size: s ansible Ansible playbooks workflows Workflow files have been modified labels May 1, 2025

# Accept the image in the receiving project
- name: Accept image membership in stackhpc-dev project
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"
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"

visibility: shared
register: image

- name: Ensure dependencies are installed
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?


# Add the image to the chosen project
- name: Add image to stackhpc-dev project
command: "{{ ansible_python_interpreter | dirname | dirname }}/bin/openstack image add project {{ image.image.id }} '{{ lookup('ansible.builtin.env', 'HOST_IMAGE_BUILD_SHARE_PROJECT_ID') }}'"
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') }}'"

Copy link
Member

@seunghun1ee seunghun1ee left a comment

Choose a reason for hiding this comment

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

Good idea but why not just setting the visibility of built images to public, so the new images could be used in all projects in both dev clouds?

register: image

- name: Ensure dependencies are installed
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:

@Alex-Welsh
Copy link
Member

Good idea but why not just setting the visibility of built images to public, so the new images could be used in all projects in both dev clouds?

Agree for SMS but can't really do that on leafcloud

@seunghun1ee
Copy link
Member

Ah that's correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ansible Ansible playbooks size: s workflows Workflow files have been modified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants