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:
parent
5be1cd99f5
commit
8e46e87cbe
13
roles/fetch-output/README.rst
Normal file
13
roles/fetch-output/README.rst
Normal 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.
|
1
roles/fetch-output/defaults/main.yaml
Normal file
1
roles/fetch-output/defaults/main.yaml
Normal file
@ -0,0 +1 @@
|
||||
zuul_output_dir: "{{ ansible_user_dir }}/zuul-output"
|
39
roles/fetch-output/tasks/main.yaml
Normal file
39
roles/fetch-output/tasks/main.yaml
Normal 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
|
Loading…
Reference in New Issue
Block a user