|
19 | 19 | openshift_namespace: "test-operator" |
20 | 20 | work_dir: "/tmp/operator-test" |
21 | 21 | testing_bin_path: "{{ work_dir }}/bin" |
22 | | - current_channel: '' # Added to avoid a potential bug with undefined variables |
| 22 | + current_channel: > |
| 23 | + '' # Added to avoid a potential |
| 24 | + bug with undefined variables |
23 | 25 | olm_ver: 0.14.1 |
24 | 26 | events_file_path: "{{ work_dir }}/events.json" |
25 | 27 |
|
|
39 | 41 | scorecard_cr_dir: "{{ work_dir }}/scorecard-cr-files" |
40 | 42 | kube_objects_dir: "{{ work_dir }}/kube_objects" |
41 | 43 | testing_bin_path: "{{ work_dir }}/bin" |
42 | | - oc_bin_path: '{{ ''kubectl'' if run_upstream else "{{ testing_bin_path }}/oc" }}' |
| 44 | + oc_bin_path: > |
| 45 | + '{{ ''kubectl'' if run_upstream else |
| 46 | + "{{ testing_bin_path }}/oc" }}' |
43 | 47 | jq_bin_path: "{{ testing_bin_path }}/jq" |
44 | 48 | yq_bin_path: "{{ testing_bin_path }}/yq" |
45 | 49 | go_bin_path: "{{ testing_bin_path }}/go/bin/go" |
|
82 | 86 | - name: "Install OLM" |
83 | 87 | block: |
84 | 88 | - name: "Installing OLM" |
85 | | - shell: "{{ operator_sdk_bin_path }} olm install --version {{ olm_ver }}" |
| 89 | + shell: > |
| 90 | + "{{ operator_sdk_bin_path }} |
| 91 | + olm install --version {{ olm_ver }}" |
86 | 92 |
|
87 | 93 | - name: "Delete catalogsource" |
88 | | - shell: "{{ oc_bin_path }} delete catalogsource operatorhubio-catalog -n olm" |
| 94 | + shell: > |
| 95 | + "{{ oc_bin_path }} delete catalogsource |
| 96 | + operatorhubio-catalog -n olm" |
89 | 97 | ignore_errors: true |
90 | 98 | when: |
91 | 99 | - olm_needed.stdout != "operatorgroup" |
|
96 | 104 | name: build_catalog_upstream |
97 | 105 | when: run_upstream|bool |
98 | 106 |
|
99 | | - - name: "Run operator-courier nest to copy the operator metadata in nested format to the work dir" |
| 107 | + - name: > |
| 108 | + "Run operator-courier nest to copy the |
| 109 | + operator metadata in nested format to the work dir" |
100 | 110 | shell: "operator-courier nest {{ operator_dir }} {{ operator_work_dir }}" |
101 | 111 | when: not run_upstream|bool |
102 | 112 |
|
103 | 113 | - name: Copy the operator metadata in nested format to the work dir |
104 | 114 | copy: |
105 | 115 | src: "{{ operator_dir }}/" |
106 | 116 | dest: "{{ operator_work_dir }}" |
107 | | - remote_src: yes |
| 117 | + remote_src: true |
108 | 118 | mode: 0644 |
109 | 119 | when: run_upstream|bool |
110 | 120 |
|
111 | 121 | - name: "Parse operator metadata needed to run the tests (Openshift)" |
112 | 122 | include_role: |
113 | 123 | name: parse_operator_metadata |
114 | 124 |
|
115 | | - - name: "Run linting tests with operator-courier verify on the deployed operator" |
| 125 | + - name: > |
| 126 | + "Run linting tests with operator-courier |
| 127 | + verify on the deployed operator" |
116 | 128 | include_role: |
117 | 129 | name: operator_courier_verify |
118 | 130 | when: run_lint|bool |
|
133 | 145 | - run_scorecard|bool |
134 | 146 | - not run_upstream|bool |
135 | 147 |
|
136 | | - - name: "Get all registry images on the OpenShift cluster before deploying the operator" |
137 | | - shell: "{{ oc_bin_path }} get is --all-namespaces -o json | jq '.items[].spec.tags[] | select(.from.kind == \"DockerImage\") | .from.name' --raw-output | sort -u" |
| 148 | + - name: > |
| 149 | + "Get all registry images on the OpenShift |
| 150 | + cluster before deploying the operator" |
| 151 | + shell: > |
| 152 | + "{{ oc_bin_path }} get is --all-namespaces |
| 153 | + -o json | jq '.items[].spec.tags[] | |
| 154 | + select(.from.kind == \"DockerImage\") | |
| 155 | + .from.name' --raw-output | sort -u" |
138 | 156 | register: os_registry_is_result_before |
139 | 157 | environment: |
140 | 158 | KUBECONFIG: "{{ kubeconfig_path }}" |
141 | 159 | no_log: true |
142 | 160 | when: not run_upstream|bool |
143 | 161 |
|
144 | | - - name: "Get all pod images on the OpenShift cluster before deploying the operator" |
145 | | - shell: "{{ oc_bin_path }} get pods --all-namespaces -o json | jq '.items[].spec.containers[].image' --raw-output | sort -u" |
| 162 | + - name: > |
| 163 | + "Get all pod images on the OpenShift |
| 164 | + cluster before deploying the operator" |
| 165 | + shell: > |
| 166 | + "{{ oc_bin_path }} get pods --all-namespaces |
| 167 | + -o json | jq '.items[].spec.containers[].image' |
| 168 | + --raw-output | sort -u" |
146 | 169 | register: os_pod_is_result_before |
147 | 170 | environment: |
148 | 171 | KUBECONFIG: "{{ kubeconfig_path }}" |
149 | 172 | no_log: true |
150 | 173 | when: not run_upstream|bool |
151 | 174 |
|
152 | 175 | - set_fact: |
153 | | - openshift_images_before: " {{ os_registry_is_result_before.stdout_lines }} + {{ os_pod_is_result_before.stdout_lines }}" |
| 176 | + openshift_images_before: > |
| 177 | + " {{ os_registry_is_result_before.stdout_lines |
| 178 | + }} + {{ os_pod_is_result_before.stdout_lines }}" |
154 | 179 | when: not run_upstream|bool |
155 | 180 |
|
156 | 181 | - name: "Set the deployment start time" |
|
186 | 211 | - run_upstream|bool |
187 | 212 |
|
188 | 213 | - name: "Get all openshift registry images" |
189 | | - shell: "{{ oc_bin_path }} get is --all-namespaces -o json | jq '.items[].spec.tags[] | select(.from.kind == \"DockerImage\") | .from.name' --raw-output | sort -u" |
| 214 | + shell: > |
| 215 | + "{{ oc_bin_path }} get is --all-namespaces |
| 216 | + -o json | jq '.items[].spec.tags[] | |
| 217 | + select(.from.kind == \"DockerImage\") | |
| 218 | + .from.name' --raw-output | sort -u" |
190 | 219 | register: os_registry_is_result_after |
191 | 220 | environment: |
192 | 221 | KUBECONFIG: "{{ kubeconfig_path }}" |
193 | 222 | no_log: true |
194 | 223 | when: not run_upstream|bool |
195 | 224 |
|
196 | 225 | - name: "Get all OpenShift pod images" |
197 | | - shell: "{{ oc_bin_path }} get pods --all-namespaces -o json | jq '.items[].spec.containers[].image' --raw-output | sort -u" |
| 226 | + shell: > |
| 227 | + "{{ oc_bin_path }} get pods --all-namespaces |
| 228 | + -o json | jq '.items[].spec.containers[].image' |
| 229 | + --raw-output | sort -u" |
198 | 230 | register: os_pod_is_result_after |
199 | 231 | environment: |
200 | 232 | KUBECONFIG: "{{ kubeconfig_path }}" |
201 | 233 | no_log: true |
202 | 234 | when: not run_upstream|bool |
203 | 235 |
|
204 | 236 | - set_fact: |
205 | | - openshift_images_after: "{{ os_registry_is_result_after.stdout_lines }} + {{ os_pod_is_result_after.stdout_lines }}" |
| 237 | + openshift_images_after: > |
| 238 | + "{{ os_registry_is_result_after.stdout_lines }} |
| 239 | + + {{ os_pod_is_result_after.stdout_lines }}" |
206 | 240 | when: not run_upstream|bool |
207 | 241 |
|
208 | 242 | - name: "Scorecard test" |
209 | 243 | block: |
210 | 244 | - name: "Find all extracted CRs from alm-examples" |
211 | | - shell: "find \"{{ scorecard_cr_dir }}\" -name \"*.cr.yaml\" -print" |
| 245 | + shell: > |
| 246 | + "find \"{{ scorecard_cr_dir }}\" |
| 247 | + -name \"*.cr.yaml\" -print" |
212 | 248 | register: scorecard_cr_files_result |
213 | 249 | when: |
214 | 250 | - run_scorecard|bool |
|
224 | 260 | - run_scorecard|bool |
225 | 261 | - run_deploy|bool |
226 | 262 | always: |
227 | | - - name: "Get the pod container logs of the operator after running scorecard tests" |
228 | | - shell: "{{ oc_bin_path }} get --output=name pods | grep {{ operator_pod_name }} | xargs -I{} {{ oc_bin_path }} logs {} -c {{ operator_container_name }}" |
| 263 | + - name: > |
| 264 | + "Get the pod container logs of the |
| 265 | + operator after running scorecard tests" |
| 266 | + shell: > |
| 267 | + "{{ oc_bin_path }} get --output=name pods |
| 268 | + | grep {{ operator_pod_name }} | xargs -I{} |
| 269 | + {{ oc_bin_path }} logs {} -c {{ |
| 270 | + operator_container_name }}" |
229 | 271 | register: operator_container_result |
230 | 272 | ignore_errors: true |
231 | 273 | environment: |
|
241 | 283 |
|
242 | 284 | when: not run_upstream|bool |
243 | 285 |
|
244 | | - - name: "Test image sources of containers introduced with the testing operator" |
| 286 | + - name: > |
| 287 | + "Test image sources of containers |
| 288 | + introduced with the testing operator" |
245 | 289 | include_role: |
246 | 290 | name: operator_imagesource_test |
247 | 291 | vars: |
248 | | - operator_images: "{{ openshift_images_after | difference(openshift_images_before) | list }}" |
| 292 | + operator_images: > |
| 293 | + "{{ openshift_images_after | |
| 294 | + difference(openshift_images_before) | list }}" |
249 | 295 | when: |
250 | 296 | - run_imagesource|bool |
251 | 297 | - run_deploy|bool |
|
262 | 308 | - run_cleanup|bool |
263 | 309 | - run_deploy|bool |
264 | 310 |
|
265 | | - - name: "Remove the quay release of the test operator in the testing namespace" |
266 | | - shell: "curl -s -H \"Authorization: basic {{ quay_token }}\" -X DELETE https://quay.io/cnr/api/v1/packages/{{ quay_namespace }}/{{ package_name }}-test/{{ quay_release }}/helm" |
| 311 | + - name: > |
| 312 | + "Remove the quay release of the |
| 313 | + test operator in the testing namespace" |
| 314 | + shell: > |
| 315 | + "curl -s -H \"Authorization: basic {{ quay_token }}\" |
| 316 | + -X DELETE https://quay.io/cnr/api/v1/packages/{{ |
| 317 | + quay_namespace }}/{{ package_name }}-test/{{ |
| 318 | + quay_release }}/helm" |
267 | 319 | when: |
268 | 320 | - quay_release is defined |
269 | 321 | - package_name is defined |
|
0 commit comments