@@ -131,6 +131,24 @@
tags:
- run_tests
+- name: Set the pathname of the results directory
+ ansible.builtin.set_fact:
+ nfstest_results_full_path: "{{ topdir_path }}/workflows/nfstest/results"
+ nfstest_results_target: "../workflows/nfstest/results/last-run"
+ when:
+ - kdevops_workflows_dedicated_workflow|bool
+ tags: copy_results
+
+- name: Clean up our localhost results/last-run directory
+ local_action: file path="{{ nfstest_results_target }}/" state=absent
+ run_once: true
+ tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
+
+- name: Create empty last-run directory
+ local_action: file path="{{ nfstest_results_target }}/" state=directory
+ run_once: true
+ tags: [ 'run_tests', 'copy_results', 'clean_local_results' ]
+
- name: Run the test group script on the target node
ansible.builtin.command:
cmd: "/tmp/runtest.sh"
@@ -138,16 +156,25 @@
- kdevops_workflows_dedicated_workflow|bool
tags: run_tests
-- name: Set the pathname of the results directory
- ansible.builtin.set_fact:
- nfstest_results_dir: "../workflows/nfstest/results/{{ ansible_kernel }}"
- when:
- - kdevops_workflows_dedicated_workflow|bool
- tags: copy_results
+- name: Get used target kernel version
+ tags: [ 'copy_results' ]
+ command: "uname -r"
+ register: uname_cmd
+
+- name: Store last kernel variable
+ tags: [ 'copy_results' ]
+ set_fact:
+ last_kernel: "{{ uname_cmd.stdout_lines | regex_replace('\\]') | regex_replace('\\[') | replace(\"'\",'') }}"
+ run_once: true
+
+- name: Document used target kernel version
+ local_action: "shell echo {{ last_kernel }} > {{ nfstest_results_target }}/../last-kernel.txt"
+ tags: [ 'run_tests', 'copy_results', 'print_results' ]
+ run_once: true
- name: Create the results directory on the control node
ansible.builtin.file:
- path: "{{ nfstest_results_dir }}"
+ path: "{{ nfstest_results_full_path }}/last-run/{{ last_kernel }}"
state: directory
mode: "u=rwx,g=rx,o=rx"
delegate_to: localhost
@@ -168,7 +195,7 @@
- name: Copy the output logs to the control node
ansible.builtin.fetch:
src: "{{ item.path }}"
- dest: "{{ nfstest_results_dir }}/{{ nfstest_test_group }}/"
+ dest: "{{ nfstest_results_full_path }}/last-run/{{ last_kernel }}/{{ nfstest_test_group }}/"
flat: true
with_items: "{{ nfstest_logs.files }}"
loop_control:
@@ -178,3 +205,20 @@
- kdevops_workflows_dedicated_workflow|bool
changed_when: false
tags: copy_results
+
+- name: Verify last-run kernel directory exists
+ tags: [ 'copy_results' ]
+ delegate_to: localhost
+ stat:
+ path: "{{ nfstest_results_full_path }}/last-run/{{ last_kernel }}"
+ register: last_run_kernel_dir
+
+- name: Copy over the last-run into the results directory for archiving into kdevops
+ copy:
+ src: "{{ nfstest_results_full_path }}/last-run/{{ last_kernel }}"
+ dest: "{{ nfstest_results_full_path }}/"
+ run_once: true
+ tags: [ 'copy_results' ]
+ delegate_to: localhost
+ when:
+ - last_run_kernel_dir.stat.exists
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 <smayhew@redhat.com> --- playbooks/roles/nfstest/tasks/main.yml | 60 ++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 8 deletions(-)