Browse Source

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
changes/43/511843/6
Monty Taylor 1 year ago
parent
commit
8e46e87cbe
No account linked to committer's email address

+ 13
- 0
roles/fetch-output/README.rst View File

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

+ 1
- 0
roles/fetch-output/defaults/main.yaml View File

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

+ 39
- 0
roles/fetch-output/tasks/main.yaml View File

@@ -0,0 +1,39 @@
1
+- name: Set log path for multiple nodes
2
+  set_fact:
3
+    log_path: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"
4
+  when: groups['all'] | length > 1
5
+
6
+- name: Set log path for single node
7
+  set_fact:
8
+    log_path: "{{ zuul.executor.log_root }}"
9
+  when: log_path is not defined
10
+
11
+- name: Ensure local output dirs
12
+  file:
13
+    path: "{{ item }}"
14
+    state: directory
15
+  with_items:
16
+    - "{{ log_path }}"
17
+    - "{{ zuul.executor.work_dir }}/artifacts"
18
+    - "{{ zuul.executor.work_dir }}/docs"
19
+
20
+- name: Collect log output
21
+  synchronize:
22
+    dest: "{{ log_path }}/"
23
+    mode: pull
24
+    src: "{{ zuul_output_dir }}/logs/"
25
+    verify_host: true
26
+
27
+- name: Collect artifacts
28
+  synchronize:
29
+    dest: "{{ zuul.executor.work_dir }}/artifacts/"
30
+    mode: pull
31
+    src: "{{ zuul_output_dir }}/artifacts/"
32
+    verify_host: true
33
+
34
+- name: Collect docs
35
+  synchronize:
36
+    dest: "{{ zuul.executor.work_dir }}/docs/"
37
+    mode: pull
38
+    src: "{{ zuul_output_dir }}/docs/"
39
+    verify_host: true

Loading…
Cancel
Save