diff --git a/roles/fetch-output/README.rst b/roles/fetch-output/README.rst new file mode 100644 index 000000000..9f59a00ca --- /dev/null +++ b/roles/fetch-output/README.rst @@ -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. diff --git a/roles/fetch-output/defaults/main.yaml b/roles/fetch-output/defaults/main.yaml new file mode 100644 index 000000000..3e6da11a9 --- /dev/null +++ b/roles/fetch-output/defaults/main.yaml @@ -0,0 +1 @@ +zuul_output_dir: "{{ ansible_user_dir }}/zuul-output" diff --git a/roles/fetch-output/tasks/main.yaml b/roles/fetch-output/tasks/main.yaml new file mode 100644 index 000000000..254cccdf7 --- /dev/null +++ b/roles/fetch-output/tasks/main.yaml @@ -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