From 046278c1476cf0430f5d41d0866b4f7934b19c61 Mon Sep 17 00:00:00 2001 From: Goutham Pacha Ravi Date: Fri, 13 Jul 2018 14:25:54 -0700 Subject: [PATCH] Attempt to copy the coverage report even if job fails Some cover jobs such as the one in openstack/manila [1] run custom coverage jobs and zuul_success=false doesn't always mean that the 'coverage' tool itself has failed to run. So, attempt to copy the coverage report if it exists. [1] http://git.openstack.org/cgit/openstack/manila/tree/tools/cover.sh Change-Id: I5487f8c6ba8185fa0bfe7d83d24df3e065e0a903 --- roles/fetch-coverage-output/tasks/main.yaml | 35 ++++++++++----------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/roles/fetch-coverage-output/tasks/main.yaml b/roles/fetch-coverage-output/tasks/main.yaml index ae283171c..d51441fdd 100644 --- a/roles/fetch-coverage-output/tasks/main.yaml +++ b/roles/fetch-coverage-output/tasks/main.yaml @@ -1,20 +1,19 @@ -- 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: Check to see if coverage report exists - stat: - path: "{{ coverage_output_src }}" - register: coverage_report_stat +- when: + - zuul_success | default(true) | bool + - not coverage_report_stat.stat.exists + name: Fail if coverage job succeeded and report is not present + fail: + msg: "Coverage report was not found even though tests succeeded" - - 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 +- when: coverage_report_stat.stat.exists + name: Collect coverage details output + synchronize: + dest: "{{ zuul_executor_dest }}" + mode: pull + src: "{{ coverage_output_src }}" + verify_host: true