Skip to content
Closed
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
42 changes: 42 additions & 0 deletions playbooks/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,48 @@
name: set_openstack_containers
when: cifmw_ci_gen_kustomize_values_deployment_version is not defined

- name: Update customContainerImages in OpenStackVersion CR with new tag
when: cifmw_ci_gen_kustomize_values_deployment_version is not defined
block:
- name: Get the OpenStackVersion CR
kubernetes.core.k8s_info:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
api_key: "{{ cifmw_openshift_token | default(omit) }}"
context: "{{ cifmw_openshift_context | default(omit) }}"
api_version: core.openstack.org/v1beta1
kind: OpenStackVersion
namespace: "{{ cifmw_update_namespace | default('openstack') }}"
register: _cifmw_update_osv_info

- name: Build retagged customContainerImages
when:
- _cifmw_update_osv_info.resources | length > 0
- _cifmw_update_osv_info.resources[0].spec.customContainerImages is defined
ansible.builtin.set_fact:
_cifmw_update_retagged_images: >-
{{
_cifmw_update_osv_info.resources[0].spec.customContainerImages |
to_json |
regex_replace('(@sha256:[a-f0-9]+|:[a-zA-Z0-9._-]+)"',
':' ~ cifmw_set_openstack_containers_tag ~ '"') |
from_json
}}

- name: Patch OpenStackVersion CR with retagged customContainerImages
when: _cifmw_update_retagged_images is defined
kubernetes.core.k8s:
kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
api_key: "{{ cifmw_openshift_token | default(omit) }}"
context: "{{ cifmw_openshift_context | default(omit) }}"
api_version: core.openstack.org/v1beta1
kind: OpenStackVersion
name: "{{ _cifmw_update_osv_info.resources[0].metadata.name }}"
namespace: "{{ cifmw_update_namespace | default('openstack') }}"
state: patched
definition:
spec:
customContainerImages: "{{ _cifmw_update_retagged_images }}"

- name: Sync repos for controller to compute
hosts: computes
gather_facts: true
Expand Down
Loading