fetch-subunit-output: collect additional subunit files

In addition to the main subunit file from zuul_work_dir,
collect the subunit files from the elements (directories)
of the zuul_additional_subunit_dirs list.

The default behavior is unchanged.

Change-Id: Ic3bc76aa104951bcc0c186347196067342e28751
This commit is contained in:
Luigi Toscano 2019-07-31 21:38:30 +02:00
parent b194dc4e1d
commit e1ac294de8
3 changed files with 16 additions and 2 deletions

View File

@ -7,6 +7,13 @@ Collect subunit outputs
Directory to work in. It has to be a fully qualified path.
.. zuul:rolevar:: zuul_additional_subunit_dirs
:default: []
List of additional directories which contains subunit files
to collect. The content of zuul_work_dir is always checked,
so it should not be added here.
.. zuul:rolevar:: tox_envlist
tox environment that was used to run the tests originally.

View File

@ -1,3 +1,4 @@
---
tox_envlist: ""
zuul_additional_subunit_dirs: []
zuul_work_dir: "{{ ansible_user_dir }}/{{ zuul.project.src_dir }}"

View File

@ -9,11 +9,17 @@
- testr_command.rc == 0
- testr_command.stdout_lines
block:
- name: Get the list of directories with subunit files
set_fact:
subunit_dirs: "{{ [ zuul_work_dir ] + zuul_additional_subunit_dirs }}"
- name: Generate subunit file
shell:
cmd: "{{ testr_command.stdout_lines[0] }} last --subunit > ./testrepository.subunit"
chdir: "{{ zuul_work_dir }}"
cmd: "{{ testr_command.stdout_lines[0] }} last --subunit >>{{ zuul_work_dir }}/testrepository.subunit"
chdir: "{{ item }}"
loop: "{{ subunit_dirs }}"
loop_control:
index_var: subidx
- name: Process and fetch subunit results
include: process.yaml