zuul-jobs/roles/fetch-subunit-output/tasks/process.yaml
Tristan Cacqueray a07bbee70c fetch-subunit-output: introduce zuul_use_fetch_output
This change enables using fetch-subunit-output role along with
the fetch-output role. By default the role still synchronizes
artifacts back to the executor.

Change-Id: I50a50856b96a9112c1b4be82ca04b612fd29d939
2020-01-24 21:07:50 +00:00

47 lines
1.1 KiB
YAML

- name: Find subunit2html
include: find-subunit-html.yaml
- name: Generate testr_results.html file
command: "{{ subunit_html_command }} ./testrepository.subunit testr_results.html"
args:
chdir: "{{ zuul_work_dir }}"
when: subunit_html_command is defined
- name: Find subunit files
find:
paths:
- "{{ zuul_work_dir }}"
patterns:
- testr_results.html
- testrepository.subunit
register: subunit_files
- name: Collect test-results
synchronize:
dest: "{{ zuul.executor.log_root }}"
mode: pull
src: "{{ item.path }}"
verify_host: true
with_items: "{{ subunit_files.files }}"
when: not zuul_use_fetch_output
- name: Copy test-results
copy:
dest: "{{ zuul_output_dir }}/logs/"
src: "{{ item.path }}"
remote_src: true
with_items: "{{ subunit_files.files }}"
when: zuul_use_fetch_output
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Unit Test Report"
url: "testr_results.html"
metadata:
type: unit_test_report
when: "'testr_results.html' in item.path"
with_items: "{{ subunit_files.files }}"