zuul-jobs/roles/fetch-coverage-output/tasks/main.yaml
Ian Wienand 6d23d20f2f linters: add names to blocks
This is preparation for a later version of ansbile-lint, which finds
missing names on blocks.  This seems a reasonable rule, and the
Ansible manual says [1]

  Names for blocks have been available since Ansible 2.3. We recommend
  using names in all tasks, within blocks or elsewhere, for better
  visibility into the tasks being executed when you run the playbook.

This simply adds a name tag for blocks that are missing it.  This
should have no operational change, but allows us to update the linter
in a follow-on change.

[1] https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html

Change-Id: I92ed4616775650aced352bc9088a07e919f1a25f
2022-07-27 17:13:39 +10:00

34 lines
905 B
YAML

- name: Check to see if coverage report exists
stat:
path: "{{ coverage_output_src }}"
register: coverage_report_stat
- name: Fail if coverage job succeeded and report is not present
when:
- zuul_success | default(true) | bool
- not coverage_report_stat.stat.exists
fail:
msg: "Coverage report was not found even though tests succeeded"
- name: Collect coverage
when: coverage_report_stat.stat.exists
block:
- name: Collect coverage details output
synchronize:
dest: "{{ zuul_executor_dest }}"
mode: pull
src: "{{ coverage_output_src }}"
verify_host: true
owner: no
group: no
- name: Return artifact to Zuul
zuul_return:
data:
zuul:
artifacts:
- name: "Coverage data"
url: "cover/"
metadata:
type: coverage_data