|
| 1 | +- name: Determine name of deployed NodeSet |
| 2 | + environment: |
| 3 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 4 | + PATH: "{{ cifmw_path }}" |
| 5 | + cifmw.general.ci_script: |
| 6 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 7 | + script: >- |
| 8 | + oc get -n {{ cifmw_validations_namespace }} osdpns --no-headers -o custom-columns=":metadata.name" |
| 9 | + register: deployed_nodeset_name |
| 10 | + |
| 11 | +- name: Clean cache on a compute node |
| 12 | + become: true |
| 13 | + ansible.builtin.shell: |
| 14 | + cmd: >- |
| 15 | + set -o pipefail && dnf clean all |
| 16 | + delegate_to: "{{ cifmw_validations_edpm_check_node }}" |
| 17 | + |
| 18 | +- name: Uninstall requested packages on a compute node |
| 19 | + become: true |
| 20 | + ansible.builtin.dnf: |
| 21 | + name: "{{ item_cached_package }}" |
| 22 | + state: absent |
| 23 | + loop: "{{ cifmw_validations_cached_packages }}" |
| 24 | + loop_control: |
| 25 | + loop_var: item_cached_package |
| 26 | + delegate_to: "{{ cifmw_validations_edpm_check_node }}" |
| 27 | + |
| 28 | +- name: Patch nodeset with download cache configuration |
| 29 | + environment: |
| 30 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 31 | + PATH: "{{ cifmw_path }}" |
| 32 | + cifmw.general.ci_script: |
| 33 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 34 | + script: >- |
| 35 | + oc patch -n {{ cifmw_validations_namespace }} osdpns/"{{ deployed_nodeset_name.stdout | trim }}" --type json --patch '[{ "op": "add", "path": "/spec/nodeTemplate/ansible/ansibleVars/edpm_download_cache_running_services","value": {{ cifmw_validations_cache_run_services }} }]' |
| 36 | +
|
| 37 | +- name: Wait for nodeset to be SetupReady again |
| 38 | + environment: |
| 39 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 40 | + PATH: "{{ cifmw_path }}" |
| 41 | + cifmw.general.ci_script: |
| 42 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 43 | + script: >- |
| 44 | + oc wait osdpns "{{ deployed_nodeset_name.stdout | trim }}" |
| 45 | + --namespace={{ cifmw_validations_namespace }} |
| 46 | + --for=condition=SetupReady |
| 47 | + --timeout={{ cifmw_validations_timeout }}m |
| 48 | +
|
| 49 | +- name: Create openstackdataplanedeployment for download cache service |
| 50 | + environment: |
| 51 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 52 | + PATH: "{{ cifmw_path }}" |
| 53 | + cifmw.general.ci_script: |
| 54 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 55 | + script: | |
| 56 | + oc apply -f - <<EOF |
| 57 | + apiVersion: dataplane.openstack.org/v1beta1 |
| 58 | + kind: OpenStackDataPlaneDeployment |
| 59 | + metadata: |
| 60 | + name: download-cache-service |
| 61 | + namespace: {{ cifmw_validations_namespace }} |
| 62 | + spec: |
| 63 | + nodeSets: |
| 64 | + - "{{ deployed_nodeset_name.stdout | trim }}" |
| 65 | + servicesOverride: |
| 66 | + - download-cache |
| 67 | + EOF |
| 68 | +
|
| 69 | +- name: Wait for download cache service deployment to be complete |
| 70 | + environment: |
| 71 | + KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}" |
| 72 | + PATH: "{{ cifmw_path }}" |
| 73 | + cifmw.general.ci_script: |
| 74 | + output_dir: "{{ cifmw_validations_basedir }}/artifacts" |
| 75 | + script: >- |
| 76 | + oc wait openstackdataplanedeployment download-cache-service |
| 77 | + --namespace={{ cifmw_validations_namespace }} |
| 78 | + --for=condition=ready |
| 79 | + --timeout={{ cifmw_validations_timeout }}s |
| 80 | +
|
| 81 | +- name: Find all rpm packages cached on compute node |
| 82 | + become: true |
| 83 | + ansible.builtin.shell: |
| 84 | + cmd: >- |
| 85 | + set -o pipefail && find /var/cache/dnf/ -name "*.rpm" |
| 86 | + delegate_to: "{{ cifmw_validations_edpm_check_node }}" |
| 87 | + register: dnf_cached_packages |
| 88 | + |
| 89 | +# Create failure msg for xml results file |
| 90 | +- name: Verify all requested packages were cached |
| 91 | + ansible.builtin.fail: |
| 92 | + msg: "'{{ item_cached_package }}' package was not cached" |
| 93 | + loop: "{{ cifmw_validations_cached_packages }}" |
| 94 | + loop_control: |
| 95 | + loop_var: item_cached_package |
| 96 | + when: item_cached_package+'-' not in dnf_cached_packages.stdout |
| 97 | + |
| 98 | +- name: Find all container images cached on compute node |
| 99 | + become: true |
| 100 | + ansible.builtin.shell: |
| 101 | + cmd: >- |
| 102 | + set -o pipefail && podman images |
| 103 | + delegate_to: "{{ cifmw_validations_edpm_check_node }}" |
| 104 | + register: podman_images |
| 105 | + |
| 106 | +# Create failure msg for xml results file |
| 107 | +- name: Verify all requested container images were cached |
| 108 | + ansible.builtin.fail: |
| 109 | + msg: "'{{ item_cached_image }}' container image was not cached" |
| 110 | + loop: "{{ cifmw_validations_cached_images }}" |
| 111 | + loop_control: |
| 112 | + loop_var: item_cached_image |
| 113 | + when: item_cached_image+' ' not in podman_images.stdout |
| 114 | + |
| 115 | +- name: Reinstall requested packages on a compute node |
| 116 | + become: true |
| 117 | + ansible.builtin.dnf: |
| 118 | + name: "{{ item_cached_package }}" |
| 119 | + state: present |
| 120 | + loop: "{{ cifmw_validations_cached_packages }}" |
| 121 | + loop_control: |
| 122 | + loop_var: item_cached_package |
| 123 | + delegate_to: "{{ cifmw_validations_edpm_check_node }}" |
0 commit comments