Only upload actual existing coverage.xml artifacts
If the "main build job" fails, there will not be any coverage.xml, so
the post-run playbook would fail as well. This is suboptimal because the
user would see a "FAILURE_POST" build result instead of the expected
"FAILURE".
Change-Id: I386b7a78e0db36995dd0841f059f5b6657ddb804
diff --git a/roles/fetch-coverage-xml/tasks/main.yaml b/roles/fetch-coverage-xml/tasks/main.yaml
index 5fade16..c247e49 100644
--- a/roles/fetch-coverage-xml/tasks/main.yaml
+++ b/roles/fetch-coverage-xml/tasks/main.yaml
@@ -4,13 +4,23 @@
log_path: "{{ zuul.executor.log_root }}/"
when: log_path is not defined
+- name: Check for coverage.xml
+ stat:
+ path: "{{ coverage_xml_dir }}/coverage.xml"
+ get_checksum: false
+ get_mime: false
+ get_md5: false
+ register: coverage_xml_stat
+
- name: Collect coverage.xml
synchronize:
src: "{{ coverage_xml_dir }}/coverage.xml"
dest: "{{ log_path }}/coverage.xml"
mode: pull
+ when: coverage_xml_stat.stat.exists
- name: Return site artifact location to Zuul
+ when: coverage_xml_stat.stat.exists
zuul_return:
data:
zuul: