Skip to content

Commit e30a7d1

Browse files
committed
gitr: add last-run directory and last-kernel.txt to the results
Create the last-run directory and last-kernel.txt file in a manner similar to the way the fstests workflow does it. This will make it easier to get at the most recent test results for reporting purposes. Signed-off-by: Scott Mayhew <[email protected]>
1 parent b3432fd commit e30a7d1

File tree

1 file changed

+51
-8
lines changed

1 file changed

+51
-8
lines changed

playbooks/roles/gitr/tasks/main.yml

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,43 @@
2424
- name: Set the pathname of the local results directory
2525
tags: vars
2626
ansible.builtin.set_fact:
27-
gitr_results_dir: "../workflows/gitr/results/{{ ansible_kernel }}/{{ gitr_test_group }}/"
27+
gitr_results_full_path: "{{ topdir_path }}/workflows/gitr/results"
28+
gitr_results_target: "../workflows/gitr/results/last-run"
2829
gitr_run_uniqifier: "{{ ansible_date_time.iso8601_basic_short }}"
2930

31+
- name: Clean up our localhost results/last-run directory
32+
local_action: file path="{{ gitr_results_target }}/" state=absent
33+
run_once: true
34+
tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
35+
36+
- name: Create empty last-run directory
37+
local_action: file path="{{ gitr_results_target }}/" state=directory
38+
run_once: true
39+
tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
40+
41+
- name: Get used target kernel version
42+
tags: [ 'copy_results' ]
43+
command: "uname -r"
44+
register: uname_cmd
45+
46+
- name: Store last kernel variable
47+
tags: [ 'copy_results' ]
48+
set_fact:
49+
last_kernel: "{{ uname_cmd.stdout_lines | regex_replace('\\]') | regex_replace('\\[') | replace(\"'\",'') }}"
50+
run_once: true
51+
52+
- name: Document used target kernel version
53+
local_action: "shell echo {{ last_kernel }} > {{ gitr_results_target }}/../last-kernel.txt"
54+
tags: [ 'run_tests', 'copy_results', 'print_results' ]
55+
run_once: true
56+
3057
- name: Ensure the local results directory exists
3158
tags: copy_results
3259
ansible.builtin.file:
33-
path: "{{ gitr_results_dir }}"
60+
path: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}/{{ gitr_test_group }}"
3461
state: directory
3562
mode: "u=rwx,g=rx,o=rx"
3663
delegate_to: localhost
37-
run_once: true
3864

3965
- name: Install dependencies for the git regression tests
4066
tags: gitr
@@ -303,23 +329,23 @@
303329
tags: copy_results
304330
ansible.builtin.fetch:
305331
src: "/tmp/{{ gitr_run_uniqifier }}.tgz"
306-
dest: "{{ gitr_results_dir }}"
332+
dest: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}/{{ gitr_test_group }}/"
307333
flat: true
308334
validate_checksum: true
309335

310336
- name: Copy summary results to the control node
311337
tags: copy_results
312338
ansible.builtin.fetch:
313339
src: "{{ gitr_mnt }}/{{ gitr_run_uniqifier }}.summary"
314-
dest: "{{ gitr_results_dir }}"
340+
dest: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}/{{ gitr_test_group }}/"
315341
flat: true
316342
validate_checksum: false
317343

318344
- name: Copy stderr to the control node
319345
tags: copy_results
320346
ansible.builtin.fetch:
321347
src: "{{ gitr_mnt }}/{{ gitr_run_uniqifier }}.stderr"
322-
dest: "{{ gitr_results_dir }}"
348+
dest: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}/{{ gitr_test_group }}/"
323349
flat: true
324350
validate_checksum: false
325351
when: gitr_results.rc != 0
@@ -328,7 +354,7 @@
328354
tags: copy_results
329355
ansible.builtin.fetch:
330356
src: "{{ gitr_mnt }}/{{ gitr_run_uniqifier }}.rpc"
331-
dest: "{{ gitr_results_dir }}"
357+
dest: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}/{{ gitr_test_group }}/"
332358
flat: true
333359
validate_checksum: false
334360
when:
@@ -339,9 +365,26 @@
339365
tags: copy_results
340366
ansible.builtin.fetch:
341367
src: "{{ gitr_mnt }}/{{ gitr_run_uniqifier }}.xprt"
342-
dest: "{{ gitr_results_dir }}"
368+
dest: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}/{{ gitr_test_group }}/"
343369
flat: true
344370
validate_checksum: false
345371
when:
346372
- gitr_fstype == "nfs"
347373
- ansible_os_family == 'RedHat'
374+
375+
- name: Verify last-run kernel directory exists
376+
tags: [ 'copy_results' ]
377+
delegate_to: localhost
378+
stat:
379+
path: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}"
380+
register: last_run_kernel_dir
381+
382+
- name: Copy over the last-run into the results directory for archiving into kdevops
383+
copy:
384+
src: "{{ gitr_results_full_path }}/last-run/{{ last_kernel }}"
385+
dest: "{{ gitr_results_full_path }}/"
386+
run_once: true
387+
tags: [ 'copy_results' ]
388+
delegate_to: localhost
389+
when:
390+
- last_run_kernel_dir.stat.exists

0 commit comments

Comments
 (0)