|
20 | 20 | tags: ['vars'] |
21 | 21 | ansible.builtin.set_fact: |
22 | 22 | ltp_test_group: "{{ ansible_host | regex_replace(kdevops_host_prefix + '-') | regex_replace('-dev') }}" |
23 | | - ltp_results_dir: "../workflows/ltp/results/{{ ansible_kernel }}" |
| 23 | + ltp_results_full_path: "{{ topdir_path }}/workflows/ltp/results" |
| 24 | + ltp_results_target: "../workflows/ltp/results/last-run" |
24 | 25 |
|
25 | 26 | - name: Create the local results directory |
26 | 27 | tags: ['first_run'] |
27 | 28 | ansible.builtin.file: |
28 | | - path: "{{ ltp_results_dir }}" |
| 29 | + path: "{{ ltp_results_full_path }}" |
29 | 30 | state: directory |
30 | 31 | mode: "u=rwx,g=rx,o=rx" |
31 | 32 | delegate_to: localhost |
32 | 33 | run_once: true |
33 | 34 |
|
| 35 | +- name: Clean up our localhost results/last-run directory |
| 36 | + local_action: file path="{{ ltp_results_target }}/" state=absent |
| 37 | + run_once: true |
| 38 | + tags: [ 'run_tests', 'copy_results', 'clean_local_results' ] |
| 39 | + |
| 40 | +- name: Create empty last-run directory |
| 41 | + local_action: file path="{{ ltp_results_target }}/" state=directory |
| 42 | + run_once: true |
| 43 | + tags: [ 'run_tests', 'copy_results', 'clean_local_results' ] |
| 44 | + |
| 45 | +- name: Get used target kernel version |
| 46 | + tags: [ 'copy_results' ] |
| 47 | + command: "uname -r" |
| 48 | + register: uname_cmd |
| 49 | + |
| 50 | +- name: Store last kernel variable |
| 51 | + tags: [ 'copy_results' ] |
| 52 | + set_fact: |
| 53 | + last_kernel: "{{ uname_cmd.stdout_lines | regex_replace('\\]') | regex_replace('\\[') | replace(\"'\",'') }}" |
| 54 | + run_once: true |
| 55 | + |
| 56 | +- name: Document used target kernel version |
| 57 | + local_action: "shell echo {{ last_kernel }} > {{ ltp_results_target }}/../last-kernel.txt" |
| 58 | + tags: [ 'run_tests', 'copy_results', 'print_results' ] |
| 59 | + run_once: true |
| 60 | + |
| 61 | +- name: Ensure the local results directory exists |
| 62 | + tags: copy_results |
| 63 | + ansible.builtin.file: |
| 64 | + path: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}" |
| 65 | + state: directory |
| 66 | + mode: "u=rwx,g=rx,o=rx" |
| 67 | + delegate_to: localhost |
| 68 | + |
34 | 69 | - name: Set OS-specific variables |
35 | 70 | ansible.builtin.include_vars: "{{ lookup('ansible.builtin.first_found', params) }}" |
36 | 71 | vars: |
|
194 | 229 | tags: ['copy_results'] |
195 | 230 | ansible.builtin.fetch: |
196 | 231 | src: "{{ item.path }}" |
197 | | - dest: "{{ ltp_results_dir }}/{{ ltp_test_group }}/" |
| 232 | + dest: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}/" |
198 | 233 | flat: true |
199 | 234 | validate_checksum: false |
200 | 235 | with_items: "{{ results_files.files }}" |
|
216 | 251 | tags: ['copy_results'] |
217 | 252 | ansible.builtin.fetch: |
218 | 253 | src: "{{ item.path }}" |
219 | | - dest: "{{ ltp_results_dir }}/{{ ltp_test_group }}/" |
| 254 | + dest: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}/{{ ltp_test_group }}/" |
220 | 255 | flat: true |
221 | 256 | validate_checksum: false |
222 | 257 | with_items: "{{ output_files.files }}" |
223 | 258 | when: |
224 | 259 | - output_files.matched > 0 |
225 | 260 | loop_control: |
226 | 261 | label: "Copying {{ item.path | basename }} ..." |
| 262 | + |
| 263 | +- name: Verify last-run kernel directory exists |
| 264 | + tags: [ 'copy_results' ] |
| 265 | + delegate_to: localhost |
| 266 | + stat: |
| 267 | + path: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}" |
| 268 | + register: last_run_kernel_dir |
| 269 | + |
| 270 | +- name: Copy over the last-run into the results directory for archiving into kdevops |
| 271 | + copy: |
| 272 | + src: "{{ ltp_results_full_path }}/last-run/{{ last_kernel }}" |
| 273 | + dest: "{{ ltp_results_full_path }}/" |
| 274 | + run_once: true |
| 275 | + tags: [ 'copy_results' ] |
| 276 | + delegate_to: localhost |
| 277 | + when: |
| 278 | + - last_run_kernel_dir.stat.exists |
0 commit comments