zuul-jobs/roles/fetch-coverage-output/tasks/main.yaml
Monty Taylor b6adb9a8c4 Don't fetch coverage report from failing tests
When test runs fail, coverage reports are not generated. We try to fetch
them anyway, which leads to POST_FAILURE instead of FAILURE.

Add in a check to ensure the test run was successful, then a check for
the coverage dir and an explicit error message so that it's clear to
people that the issue is that coverage wasn't generated after a
successful run, rather than there being an issue with rsync or
something.

Change-Id: I07f942a9df518d6602ee151d82b35ce413769c73
2018-01-17 19:53:57 +01:00

21 lines
613 B
YAML

- when: zuul_success | default(true) | bool
block:
- name: Check to see if coverage report exists
stat:
path: "{{ coverage_output_src }}"
register: coverage_report_stat
- name: Collect coverage details output
synchronize:
dest: "{{ zuul_executor_dest }}"
mode: pull
src: "{{ coverage_output_src }}"
verify_host: true
when: coverage_report_stat.stat.exists
- name: Fail if coverage report not found
fail:
msg: "Coverage report was not found even though tests succeeded"
when: not coverage_report_stat.stat.exists