Skip to content

Commit 0619320

Browse files
committed
CI: Register overcloud host image as shared and add stackhpc-dev
In order for developers to be able to use overcloud images for testing, they must be available in the stackhpc-dev project on Leafcloud. To do this we can make the image shared, and add stackhpc-dev as a member. Unfortunately someone in the stackhpc-dev project must also accept the image membership before it becomes active. It's not possible to do this with the existing app creds which are scoped to the stackhpc-ci project. Instead we provide instructions on how to do it as a debug message.
1 parent ee07cd3 commit 0619320

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

etc/kayobe/ansible/openstack-host-image-upload.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131

3232
- name: Ensure dependencies are installed
3333
pip:
34-
name: openstacksdk
34+
name: python-openstackclient
35+
virtualenv: "{{ ansible_python_interpreter | dirname | dirname }}"
3536

3637
- name: Upload an image to Glance
3738
openstack.cloud.image:
@@ -41,6 +42,33 @@
4142
disk_format: qcow2
4243
state: present
4344
filename: "{{ local_image_path }}"
45+
# FIXME: Uncomment this when we have a newer openstack.cloud collection
46+
#visibility: shared
47+
register: image
48+
49+
# FIXME: Remove this when we have a newer openstack.cloud collection
50+
- name: Make the image shared
51+
command: openstack image set --shared {{ image.image.id }}
52+
53+
# Allow users in stackhpc-dev to use these images.
54+
- name: Add image to stackhpc-dev project
55+
command: openstack image add project {{ image.image.id }} stackhpc-dev
56+
57+
# FIXME: This needs to be done when authenticated in the stackhpc-dev
58+
# project, but we don't have an app cred for this. It must be done
59+
# manually for now.
60+
# - name: Accept image membership in stackhpc-dev project
61+
# command: openstack image set {{ image.image.id }} --accept
62+
63+
- name: Display how to add the image to the stackhpc-dev project
64+
debug:
65+
msg: |-
66+
The {{ image_name }} image has been shared with the stackhpc-dev
67+
project but it must be accepted by a user authenticated in the
68+
stackhpc-dev project before it can be used there. This can be
69+
done using the following command:
70+
71+
openstack image add project {{ image.image.id }} stackhpc-dev
4472
4573
always:
4674
- name: Remove clouds.yaml

0 commit comments

Comments
 (0)