|
16 | 16 | oc get osdpns -n {{ cifmw_validations_namespace }} --no-headers -o custom-columns=":metadata.name" |
17 | 17 | register: deployed_nodeset_name |
18 | 18 |
|
| 19 | +# Collect running image before the hotfix is applied |
| 20 | +- name: Collect the image currently used by nova_compute on the edpm node |
| 21 | + become: true |
| 22 | + ansible.builtin.shell: |
| 23 | + cmd: >- |
| 24 | + set -o pipefail && podman inspect nova_compute | jq '.[].ImageName' | tr -d '"' |
| 25 | + delegate_to: "{{ cifmw_validations_edpm_check_node }}" |
| 26 | + register: original_nova_compute_image |
| 27 | + |
19 | 28 | # Simulate hotfixed image by update edpm_nova_compute_image to a different, non-default value |
20 | 29 | - name: Update edpm_nova_compute_image value |
21 | 30 | environment: |
|
90 | 99 | that: |
91 | 100 | - cifmw_validations_hotfixed_edpm_nova_compute_image == post_change_nova_compute_image.stdout |
92 | 101 |
|
| 102 | +# Restore hot fixed image to original value |
| 103 | +- name: Update edpm_nova_compute_image value |
| 104 | + environment: |
| 105 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 106 | + PATH: "{{ cifmw_path }}" |
| 107 | + cifmw.general.ci_script: |
| 108 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 109 | + script: >- |
| 110 | + oc patch -n {{ cifmw_validations_namespace }} |
| 111 | + osdpns/"{{ deployed_nodeset_name.stdout | trim }}" |
| 112 | + --type=merge -p '{"spec": {"nodeTemplate": {"ansible": {"ansibleVars": {"edpm_nova_compute_image": "{{ original_nova_compute_image.stdout }}"}}}}}' |
| 113 | +
|
| 114 | +# loop check the status of the openstackdataplanenodeset until it is either SetupReady, |
| 115 | +# or reaches a defined timeout value. |
| 116 | +- name: Wait for nodeset to be SetupReady again |
| 117 | + environment: |
| 118 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 119 | + PATH: "{{ cifmw_path }}" |
| 120 | + cifmw.general.ci_script: |
| 121 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 122 | + script: >- |
| 123 | + oc wait osdpns "{{ deployed_nodeset_name.stdout | trim }}" |
| 124 | + --namespace={{ cifmw_validations_namespace }} |
| 125 | + --for=condition=SetupReady |
| 126 | + --timeout={{ cifmw_validations_timeout }}m |
| 127 | +
|
| 128 | +# Create a new OpenStackDataPlaneDeployment to restore the original image |
| 129 | +- name: Create openstackdataplanedeployment to rollout changes |
| 130 | + environment: |
| 131 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 132 | + PATH: "{{ cifmw_path }}" |
| 133 | + cifmw.general.ci_script: |
| 134 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 135 | + script: | |
| 136 | + oc apply -f - <<EOF |
| 137 | + apiVersion: dataplane.openstack.org/v1beta1 |
| 138 | + kind: OpenStackDataPlaneDeployment |
| 139 | + metadata: |
| 140 | + name: remove-edpm-hotfix |
| 141 | + namespace: {{ cifmw_validations_namespace }} |
| 142 | + spec: |
| 143 | + nodeSets: |
| 144 | + - "{{ deployed_nodeset_name.stdout | trim }}" |
| 145 | + servicesOverride: |
| 146 | + - "{{ cifmw_validations_custom_nova_service }}" |
| 147 | + EOF |
| 148 | +
|
| 149 | +# loop check the status of the openstackdataplanedeployment until it is either completed, |
| 150 | +# or reaches a defined timeout value. |
| 151 | +- name: Wait for deployment to be complete |
| 152 | + environment: |
| 153 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 154 | + PATH: "{{ cifmw_path }}" |
| 155 | + cifmw.general.ci_script: |
| 156 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 157 | + script: >- |
| 158 | + oc wait openstackdataplanedeployment remove-edpm-hotfix |
| 159 | + --namespace={{ cifmw_validations_namespace }} |
| 160 | + --for=condition=ready |
| 161 | + --timeout={{ cifmw_validations_timeout }}m |
| 162 | +
|
| 163 | +# Collect running image to assert the hotfix was removed |
| 164 | +- name: Collect the image currently used by nova_compute on the edpm node |
| 165 | + become: true |
| 166 | + ansible.builtin.shell: |
| 167 | + cmd: >- |
| 168 | + set -o pipefail && podman inspect nova_compute | jq '.[].ImageName' | tr -d '"' |
| 169 | + delegate_to: "{{ cifmw_validations_edpm_check_node }}" |
| 170 | + register: post_remove_nova_compute_image |
| 171 | + |
| 172 | +# these assertions will determine whether this job has ultimately been successful or not. |
| 173 | +# here, we should list all of the assertions required to satisfy our feature requirements. |
| 174 | +- name: Assert state change reflects our requirements |
| 175 | + ansible.builtin.assert: |
| 176 | + that: |
| 177 | + - original_nova_compute_image.stdout == post_remove_nova_compute_image.stdout |
| 178 | + |
93 | 179 | - name: Wait for all nova-compute services to be up after hotfix rollout |
94 | 180 | cifmw.general.ci_script: |
95 | 181 | output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
|
0 commit comments