Add role to fetch output from nodes

When jobs put their output into output dirs, it needs to be fetched back
to the executors for publication.

Change-Id: I3dfbbd4327102b62160713ca782dfa4b13d26924
This commit is contained in:
Monty Taylor 2017-10-13 08:09:13 -05:00
parent 5be1cd99f5
commit 8e46e87cbe
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
3 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,13 @@
Collect output from build nodes
This role collects logs, artifacts and docs from subdirs of the
``zuul_output_dir`` on the remote nodes to equivalent directories
on the executor so that later parts of the system can publish the
content to appropriate permanent locations.
**Role Variables**
.. zuul:rolevar:: zuul_output_dir
:default: {{ ansible_user_dir }}/zuul-output
Base directory for collecting job output.

View File

@ -0,0 +1 @@
zuul_output_dir: "{{ ansible_user_dir }}/zuul-output"

View File

@ -0,0 +1,39 @@
- name: Set log path for multiple nodes
set_fact:
log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
when: groups['all'] | length > 1
- name: Set log path for single node
set_fact:
log_path: "{{ zuul.executor.log_root }}"
when: log_path is not defined
- name: Ensure local output dirs
file:
path: "{{ item }}"
state: directory
with_items:
- "{{ log_path }}"
- "{{ zuul.executor.work_dir }}/artifacts"
- "{{ zuul.executor.work_dir }}/docs"
- name: Collect log output
synchronize:
dest: "{{ log_path }}/"
mode: pull
src: "{{ zuul_output_dir }}/logs/"
verify_host: true
- name: Collect artifacts
synchronize:
dest: "{{ zuul.executor.work_dir }}/artifacts/"
mode: pull
src: "{{ zuul_output_dir }}/artifacts/"
verify_host: true
- name: Collect docs
synchronize:
dest: "{{ zuul.executor.work_dir }}/docs/"
mode: pull
src: "{{ zuul_output_dir }}/docs/"
verify_host: true