From 74a40ec89ecd57a6d3463623618029efceae8398 Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Tue, 17 Oct 2017 21:51:47 -0400 Subject: [PATCH] Collect output from coverage job Add a post-run playbook to tox-cover job to collect the coverage report detail and copy it to the log root of the executor. Change-Id: Ibad091f7630832eb993133b0f43a60931b3dfd75 --- playbooks/tox/cover-post.yaml | 3 +++ roles/fetch-coverage-output/README.rst | 20 +++++++++++++++++++ .../fetch-coverage-output/defaults/main.yaml | 2 ++ roles/fetch-coverage-output/tasks/main.yaml | 6 ++++++ zuul.yaml | 1 + 5 files changed, 32 insertions(+) create mode 100644 playbooks/tox/cover-post.yaml create mode 100644 roles/fetch-coverage-output/README.rst create mode 100644 roles/fetch-coverage-output/defaults/main.yaml create mode 100644 roles/fetch-coverage-output/tasks/main.yaml diff --git a/playbooks/tox/cover-post.yaml b/playbooks/tox/cover-post.yaml new file mode 100644 index 000000000..946b0c101 --- /dev/null +++ b/playbooks/tox/cover-post.yaml @@ -0,0 +1,3 @@ +- hosts: all + roles: + - role: fetch-coverage-output diff --git a/roles/fetch-coverage-output/README.rst b/roles/fetch-coverage-output/README.rst new file mode 100644 index 000000000..4058566ff --- /dev/null +++ b/roles/fetch-coverage-output/README.rst @@ -0,0 +1,20 @@ +Collect output from a coverage run + +By default, this copies the output from a coverage run +on the worker to the log root of the executor. + +**Role Variables** + +.. zuul:rolevar:: zuul_executor_dest + :default: {{ zuul.executor.log_root }} + + The destination directory on the executor. By default, the log + root. + +.. zuul:rolevar:: coverage_output_src + :default: {{ zuul.project.canonical_name }}/cover/ + + The location on the worker from which to fetch the coverage + output detail. By default, the ``cover`` dir of the current + project. + diff --git a/roles/fetch-coverage-output/defaults/main.yaml b/roles/fetch-coverage-output/defaults/main.yaml new file mode 100644 index 000000000..9181dddf2 --- /dev/null +++ b/roles/fetch-coverage-output/defaults/main.yaml @@ -0,0 +1,2 @@ +zuul_executor_dest: "{{ zuul.executor.log_root }}" +coverage_output_src: "src/{{ zuul.project.canonical_name }}/cover/" diff --git a/roles/fetch-coverage-output/tasks/main.yaml b/roles/fetch-coverage-output/tasks/main.yaml new file mode 100644 index 000000000..63a627ad2 --- /dev/null +++ b/roles/fetch-coverage-output/tasks/main.yaml @@ -0,0 +1,6 @@ +- name: Collect coverage details output + synchronize: + dest: "{{ zuul_executor_dest }}" + mode: pull + src: "{{ coverage_output_src }}" + verify_host: true diff --git a/zuul.yaml b/zuul.yaml index bf1e29654..2ccc4f185 100644 --- a/zuul.yaml +++ b/zuul.yaml @@ -123,6 +123,7 @@ Run code coverage tests. Uses tox with the ``cover`` environment. + post-run: playbooks/cover/tox/cover-post vars: tox_envlist: cover