|
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 }}" |
50 |
| - retries: "{{ (cifmw_test_operator_timeout / 10) | round | int }}" |
51 |
| - delay: 10 |
| 49 | + - "instanceName={{ test_operator_instance_name }}" |
| 50 | + # retries: "{{ (cifmw_test_operator_timeout / 10) | round | int }}" |
| 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 | +# - name: message |
| 60 | +# debug: |
| 61 | +# msg: "{{ testpod.status }}" |
| 62 | + |
| 63 | +# - name: fail |
| 64 | +# fail: |
| 65 | +# msg: "tortuga" |
| 66 | + |
| 67 | +# - name: debug |
| 68 | +# debug: |
| 69 | +# var: testpod |
| 70 | + |
59 | 71 | - name: Check whether timed out - {{ run_test_fw }}
|
60 | 72 | ansible.builtin.set_fact:
|
61 |
| - testjob_timed_out: >- |
62 |
| - {{ testjob.attempts == (cifmw_test_operator_timeout / 10) | round | int }} |
| 73 | + testpod_timed_out: >- |
| 74 | + {{ testpod.attempts == (cifmw_test_operator_timeout / 10) | round | int }} |
63 | 75 | when: not cifmw_test_operator_dry_run | bool
|
64 | 76 |
|
65 | 77 | - name: Collect logs
|
66 | 78 | when:
|
67 | 79 | - not cifmw_test_operator_dry_run | bool
|
68 |
| - - not testjob_timed_out |
| 80 | + - not testpod_timed_out |
69 | 81 | block:
|
70 | 82 | - name: Reset volumes and volume_mounts to an empty list
|
71 | 83 | ansible.builtin.set_fact:
|
|
79 | 91 | context: "{{ cifmw_openshift_context | default(omit)}}"
|
80 | 92 | kind: PersistentVolumeClaim
|
81 | 93 | label_selectors:
|
82 |
| - - "instanceName={{ test_operator_job_name }}" |
| 94 | + - "instanceName={{ test_operator_instance_name }}" |
83 | 95 | register: logsPVCs
|
84 | 96 |
|
85 | 97 | - name: Set up volume mounts and volumes for all PVCs
|
|
88 | 100 | {{
|
89 | 101 | (volume_mounts | default([])) + [{
|
90 | 102 | 'name': "logs-volume-" ~ index,
|
91 |
| - 'mountPath': "/mnt/logs-{{ test_operator_job_name }}-step-" ~ index |
| 103 | + 'mountPath': "/mnt/logs-{{ test_operator_instance_name }}-step-" ~ index |
92 | 104 | }]
|
93 | 105 | }}
|
94 | 106 | volumes: >
|
|
115 | 127 | apiVersion: v1
|
116 | 128 | kind: Pod
|
117 | 129 | metadata:
|
118 |
| - name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}" |
| 130 | + name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}" |
119 | 131 | namespace: "{{ cifmw_test_operator_namespace }}"
|
120 | 132 | spec:
|
121 | 133 | containers:
|
|
134 | 146 | context: "{{ cifmw_openshift_context | default(omit) }}"
|
135 | 147 | namespace: "{{ cifmw_test_operator_namespace }}"
|
136 | 148 | kind: Pod
|
137 |
| - name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}" |
| 149 | + name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}" |
138 | 150 | wait: true
|
139 | 151 | register: logs_pod
|
140 | 152 | until: logs_pod.resources[0].status.phase == "Running"
|
|
146 | 158 | KUBECONFIG: "{{ cifmw_openshift_kubeconfig }}"
|
147 | 159 | PATH: "{{ cifmw_path }}"
|
148 | 160 | vars:
|
149 |
| - pod_path: mnt/logs-{{ test_operator_job_name }}-step-{{ index }} |
| 161 | + pod_path: mnt/logs-{{ test_operator_instance_name }}-step-{{ index }} |
150 | 162 | ansible.builtin.shell: >
|
151 | 163 | oc cp -n {{ cifmw_test_operator_namespace }}
|
152 |
| - openstack/test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}:{{ pod_path }} |
| 164 | + openstack/test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}:{{ pod_path }} |
153 | 165 | {{ cifmw_test_operator_artifacts_basedir }}
|
154 | 166 | loop: "{{ logsPVCs.resources }}"
|
155 | 167 | loop_control:
|
|
174 | 186 | namespace: "{{ cifmw_test_operator_namespace }}"
|
175 | 187 | kind: Pod
|
176 | 188 | label_selectors:
|
177 |
| - - "instanceName={{ test_operator_job_name }}" |
| 189 | + - "instanceName={{ test_operator_instance_name }}" |
178 | 190 | when: not cifmw_test_operator_dry_run | bool
|
179 | 191 |
|
180 | 192 | - name: Get status from test pods
|
|
225 | 237 | kind: "{{ test_operator_kind_name }}"
|
226 | 238 | state: absent
|
227 | 239 | api_version: test.openstack.org/v1beta1
|
228 |
| - name: "{{ test_operator_job_name }}" |
| 240 | + name: "{{ test_operator_instance_name }}" |
229 | 241 | namespace: "{{ cifmw_test_operator_namespace }}"
|
230 | 242 | wait: true
|
231 | 243 | wait_timeout: 600
|
|
251 | 263 | kind: Pod
|
252 | 264 | state: absent
|
253 | 265 | api_version: v1
|
254 |
| - name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_job_name }}" |
| 266 | + name: "test-operator-logs-pod-{{ run_test_fw }}-{{ test_operator_instance_name }}" |
255 | 267 | namespace: "{{ cifmw_test_operator_namespace }}"
|
256 | 268 | wait: true
|
257 | 269 | wait_timeout: 600
|
|
0 commit comments