Initialize config repository
diff --git a/roles/fetch-output-openshift/tasks/main.yaml b/roles/fetch-output-openshift/tasks/main.yaml
new file mode 100644
index 0000000..28ba3b3
--- /dev/null
+++ b/roles/fetch-output-openshift/tasks/main.yaml
@@ -0,0 +1,29 @@
+- 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
+ delegate_to: localhost
+ file:
+ path: "{{ item }}"
+ state: directory
+ with_items:
+ - "{{ log_path }}"
+ - "{{ log_path }}/npm"
+ - "{{ zuul.executor.work_root }}/artifacts"
+ - "{{ zuul.executor.work_root }}/docs"
+
+- include_tasks: rsync.yaml
+ when: item.1.pod is defined
+ loop: "{{ openshift_pods.items()|list }}"
+ run_once: true
+
+- name: Remove empty directory
+ command: find "{{ zuul.executor.work_root }}" -empty -type d -delete
+ delegate_to: localhost
diff --git a/roles/fetch-output-openshift/tasks/rsync.yaml b/roles/fetch-output-openshift/tasks/rsync.yaml
new file mode 100644
index 0000000..98643bc
--- /dev/null
+++ b/roles/fetch-output-openshift/tasks/rsync.yaml
@@ -0,0 +1,22 @@
+---
+- name: Copy zuul-output from the pod to the executor
+ command: >
+ oc --context "{{ item.1.context }}"
+ --namespace "{{ item.1.namespace }}"
+ rsync -q --progress=false
+ {{ item.1.pod }}:{{ output.src }}/
+ {{ output.dst }}/
+ no_log: true
+ delegate_to: localhost
+ loop:
+ - src: "{{ zuul_output_dir }}/logs"
+ dst: "{{ log_path }}"
+# This need: https://review.opendev.org/#/c/681748/10/roles/ensure-output-dirs/tasks/main.yaml
+# - src: "{{ zuul_output_dir }}/npm"
+# dst: "{{ log_path }}/npm"
+ - src: "{{ zuul_output_dir }}/artifacts"
+ dst: "{{ zuul.executor.work_root }}/artifacts"
+ - src: "{{ zuul_output_dir }}/docs"
+ dst: "{{ zuul.executor.work_root }}/docs"
+ loop_control:
+ loop_var: output