|
37 | 37 | definition: "{{ test_operator_cr }}"
|
38 | 38 | when: not cifmw_test_operator_dry_run | bool
|
39 | 39 |
|
40 |
| -- name: Wait for the last job to be Completed - {{ run_test_fw }} |
| 40 | +- name: Wait for the last Pod to be Completed - {{ run_test_fw }} |
41 | 41 | kubernetes.core.k8s_info:
|
42 | 42 | kubeconfig: "{{ cifmw_openshift_kubeconfig }}"
|
43 | 43 | api_key: "{{ cifmw_openshift_token | default(omit) }}"
|
44 | 44 | context: "{{ cifmw_openshift_context | default(omit) }}"
|
45 | 45 | namespace: "{{ cifmw_test_operator_namespace }}"
|
46 |
| - kind: Job |
| 46 | + kind: Pod |
47 | 47 | label_selectors:
|
48 | 48 | - "workflowStep={{ [(test_operator_workflow | length) - 1, 0] | max }}"
|
49 |
| - - "instanceName={{ test_operator_job_name }}" |
| 49 | + - "instanceName={{ test_operator_instance_name }}" |
50 | 50 | retries: "{{ (cifmw_test_operator_timeout / 10) | round | int }}"
|
51 | 51 | delay: 10
|
52 | 52 | until: >
|
53 |
| - testjob.resources[0].status.succeeded | default(0) | int >= 1 or |
54 |
| - testjob.resources[0].status.failed | default(0) | int >= 1 |
| 53 | + testpod.resources[0].status.phase == "Succeeded" or |
| 54 | + testpod.resources[0].phase == "Failed" |
55 | 55 | ignore_errors: true
|
56 |
| - register: testjob |
| 56 | + register: testpod |
57 | 57 | when: not cifmw_test_operator_dry_run | bool
|
58 | 58 |
|
59 | 59 | - name: Check whether timed out - {{ run_test_fw }}
|
60 | 60 | ansible.builtin.set_fact:
|
61 |
| - testjob_timed_out: >- |
62 |
| - {{ testjob.attempts == (cifmw_test_operator_timeout / 10) | round | int }} |
| 61 | + testpod_timed_out: >- |
| 62 | + {{ testpod.attempts == (cifmw_test_operator_timeout / 10) | round | int }} |
63 | 63 | when: not cifmw_test_operator_dry_run | bool
|
64 | 64 |
|
65 | 65 | - name: Collect logs
|
66 | 66 | when:
|
67 | 67 | - not cifmw_test_operator_dry_run | bool
|
68 |
| - - not testjob_timed_out |
| 68 | + - not testpod_timed_out |
69 | 69 | block:
|
70 | 70 | - name: Reset volumes and volume_mounts to an empty list
|
71 | 71 | ansible.builtin.set_fact:
|
|
79 | 79 | context: "{{ cifmw_openshift_context | default(omit)}}"
|
80 | 80 | kind: PersistentVolumeClaim
|
81 | 81 | label_selectors:
|
82 |
| - - "instanceName={{ test_operator_job_name }}" |
| 82 | + - "instanceName={{ test_operator_instance_name }}" |
83 | 83 | register: logsPVCs
|
84 | 84 |
|
85 | 85 | - name: Set up volume mounts and volumes for all PVCs
|
|
88 | 88 | {{
|
89 | 89 | (volume_mounts | default([])) + [{
|
90 | 90 | 'name': "logs-volume-" ~ index,
|
91 |
| - 'mountPath': "/mnt/logs-{{ test_operator_job_name }}-step-" ~ index |
| 91 | + 'mountPath': "/mnt/logs-{{ test_operator_instance_name }}-step-" ~ index |
92 | 92 | }]
|
93 | 93 | }}
|
94 | 94 | volumes: >
|
|
115 | 115 | apiVersion: v1
|
116 | 116 | kind: Pod
|
117 | 117 | metadata:
|
118 |
| - name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}" |
| 118 | + name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}" |
119 | 119 | namespace: "{{ cifmw_test_operator_namespace }}"
|
120 | 120 | spec:
|
121 | 121 | containers:
|
|
134 | 134 | context: "{{ cifmw_openshift_context | default(omit) }}"
|
135 | 135 | namespace: "{{ cifmw_test_operator_namespace }}"
|
136 | 136 | kind: Pod
|
137 |
| - name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}" |
| 137 | + name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}" |
138 | 138 | wait: true
|
139 | 139 | register: logs_pod
|
140 | 140 | until: logs_pod.resources[0].status.phase == "Running"
|
|
146 | 146 | KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
|
147 | 147 | PATH: "{{ cifmw_path }}"
|
148 | 148 | vars:
|
149 |
| - pod_path: mnt/logs-{{ test_operator_job_name }}-step-{{ index }} |
| 149 | + pod_path: mnt/logs-{{ test_operator_instance_name }}-step-{{ index }} |
150 | 150 | ansible.builtin.shell: >
|
151 | 151 | oc cp -n {{ cifmw_test_operator_namespace }}
|
152 |
| - openstack/test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}:{{ pod_path }} |
| 152 | + openstack/test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}:{{ pod_path }} |
153 | 153 | {{ cifmw_test_operator_artifacts_basedir }}
|
154 | 154 | loop: "{{ logsPVCs.resources }}"
|
155 | 155 | loop_control:
|
|
174 | 174 | namespace: "{{ cifmw_test_operator_namespace }}"
|
175 | 175 | kind: Pod
|
176 | 176 | label_selectors:
|
177 |
| - - "instanceName={{ test_operator_job_name }}" |
| 177 | + - "instanceName={{ test_operator_instance_name }}" |
178 | 178 | when: not cifmw_test_operator_dry_run | bool
|
179 | 179 |
|
180 | 180 | - name: Get status from test pods
|
|
225 | 225 | kind: "{{ test_operator_kind_name }}"
|
226 | 226 | state: absent
|
227 | 227 | api_version: test.openstack.org/v1beta1
|
228 |
| - name: "{{ test_operator_job_name }}" |
| 228 | + name: "{{ test_operator_instance_name }}" |
229 | 229 | namespace: "{{ cifmw_test_operator_namespace }}"
|
230 | 230 | wait: true
|
231 | 231 | wait_timeout: 600
|
|
251 | 251 | kind: Pod
|
252 | 252 | state: absent
|
253 | 253 | api_version: v1
|
254 |
| - name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}" |
| 254 | + name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}" |
255 | 255 | namespace: "{{ cifmw_test_operator_namespace }}"
|
256 | 256 | wait: true
|
257 | 257 | wait_timeout: 600
|
|
0 commit comments