# This job tests the functionality of the openstack-operator to take an arbitrary hotfixed # image as input, then role out the hotfix to the deployed nodes. # # This job was created to satisfy: # https://issues.redhat.com/browse/osprh-5326 # Since jobs use different names for their OpenStackDataPlaneNodeSet's, we need to dynamically # determine the name of the currently deployed one - name: Determine name of deployed NodeSet environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: >- oc get osdpns -n {{ cifmw_validations_namespace }} --no-headers -o custom-columns=":metadata.name" register: deployed_nodeset_name # Collect running image before the hotfix is applied - name: Collect the image currently used by nova_compute on the edpm node become: true ansible.builtin.shell: cmd: >- set -o pipefail && podman inspect nova_compute | jq '.[].ImageName' | tr -d '"' delegate_to: "{{ cifmw_validations_edpm_check_node }}" register: original_nova_compute_image # Simulate hotfixed image by update edpm_nova_compute_image to a different, non-default value - name: Update edpm_nova_compute_image value environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: >- oc patch -n {{ cifmw_validations_namespace }} osdpns/"{{ deployed_nodeset_name.stdout | trim }}" --type=merge -p '{"spec": {"nodeTemplate": {"ansible": {"ansibleVars": {"edpm_nova_compute_image": "{{ cifmw_validations_hotfixed_edpm_nova_compute_image }}"}}}}}' # loop check the status of the openstackdataplanenodeset until it is either SetupReady, # or reaches a defined timeout value. - name: Wait for nodeset to be SetupReady again environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: >- oc wait osdpns "{{ deployed_nodeset_name.stdout | trim }}" --namespace={{ cifmw_validations_namespace }} --for=condition=SetupReady --timeout={{ cifmw_validations_timeout }}m # Create a new OpenStackDataPlaneDeployment to apply the hotfixed image - name: Create openstackdataplanedeployment to rollout changes environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: | oc apply -f - <- oc wait openstackdataplanedeployment edpm-hotfix --namespace={{ cifmw_validations_namespace }} --for=condition=ready --timeout={{ cifmw_validations_timeout }}m # Collect running image to assert the hotfix was applied - name: Collect the image currently used by nova_compute on the edpm node ansible.builtin.shell: cmd: >- set -o pipefail && sudo podman inspect nova_compute | jq '.[].ImageName' | tr -d '"' delegate_to: "{{ cifmw_validations_edpm_check_node }}" register: post_change_nova_compute_image # these assertions will determine whether this job has ultimately been successful or not. # here, we should list all of the assertions required to satisfy our feature requirements. - name: Assert state change reflects our requirements ansible.builtin.assert: that: - cifmw_validations_hotfixed_edpm_nova_compute_image == post_change_nova_compute_image.stdout # Restore hot fixed image to original value - name: Update edpm_nova_compute_image value environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: >- oc patch -n {{ cifmw_validations_namespace }} osdpns/"{{ deployed_nodeset_name.stdout | trim }}" --type=merge -p '{"spec": {"nodeTemplate": {"ansible": {"ansibleVars": {"edpm_nova_compute_image": "{{ original_nova_compute_image.stdout }}"}}}}}' # loop check the status of the openstackdataplanenodeset until it is either SetupReady, # or reaches a defined timeout value. - name: Wait for nodeset to be SetupReady again environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: >- oc wait osdpns "{{ deployed_nodeset_name.stdout | trim }}" --namespace={{ cifmw_validations_namespace }} --for=condition=SetupReady --timeout={{ cifmw_validations_timeout }}m # Create a new OpenStackDataPlaneDeployment to restore the original image - name: Create openstackdataplanedeployment to rollout changes environment: KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" PATH: "{{ cifmw_path }}" cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: | oc apply -f - <- oc wait openstackdataplanedeployment remove-edpm-hotfix --namespace={{ cifmw_validations_namespace }} --for=condition=ready --timeout={{ cifmw_validations_timeout }}m # Collect running image to assert the hotfix was removed - name: Collect the image currently used by nova_compute on the edpm node become: true ansible.builtin.shell: cmd: >- set -o pipefail && podman inspect nova_compute | jq '.[].ImageName' | tr -d '"' delegate_to: "{{ cifmw_validations_edpm_check_node }}" register: post_remove_nova_compute_image # these assertions will determine whether this job has ultimately been successful or not. # here, we should list all of the assertions required to satisfy our feature requirements. - name: Assert state change reflects our requirements ansible.builtin.assert: that: - original_nova_compute_image.stdout == post_remove_nova_compute_image.stdout - name: Wait for all nova-compute services to be up after hotfix rollout cifmw.general.ci_script: output_dir: "{{ cifmw_validations_basedir }}/artifacts" script: >- oc -n {{ cifmw_validations_namespace }} rsh openstackclient openstack compute service list --service nova-compute -f value -c State | grep -v '^ *$' | sort -u register: _hotfix_nova_states until: - _hotfix_nova_states.rc == 0 - "'down' not in _hotfix_nova_states.stdout" - "'up' in _hotfix_nova_states.stdout" retries: 20 delay: 30