Browse Source

Merge "Add role to move docs and artifacts to log root"

changes/53/627553/4
Zuul 5 months ago
parent
commit
21ea7e8384
2 changed files with 29 additions and 0 deletions
  1. 14
    0
      roles/merge-output-to-logs/README.rst
  2. 15
    0
      roles/merge-output-to-logs/tasks/main.yaml

+ 14
- 0
roles/merge-output-to-logs/README.rst View File

@@ -0,0 +1,14 @@
1
+Put artifacts and docs into the executor log dir
2
+
3
+.. note::
4
+
5
+  This role only works in a trusted context. It is intended to
6
+  be used in the post playbook of a base job.
7
+
8
+This role moves artifacts and docs into the logs dir when
9
+``zuul.change`` is defined so that they can be uploaded to the
10
+log server for developer preview and validation.
11
+
12
+Artifacts and docs are left in place when ``zuul.change`` is
13
+not defined so that normal publication jobs can publish them
14
+to final locations.

+ 15
- 0
roles/merge-output-to-logs/tasks/main.yaml View File

@@ -0,0 +1,15 @@
1
+- name: Move artifacts and docs to logs dir
2
+  when: zuul.change is defined
3
+  delegate_to: localhost
4
+  shell: |
5
+    if ! $(ls {{ zuul.executor.work_root }}/{{ item }}) ; then
6
+      # Only create target directory if it is needed.
7
+      # Do not fail if it is already there.
8
+      mkdir -p {{ zuul.executor.log_root }}/{{ item }}
9
+      # Leave the original directory behind so that other roles
10
+      # operating on the interface directories can simply no-op.
11
+      mv -f {{ zuul.executor.work_root }}/{{ item }}/* {{ zuul.executor.log_root }}/{{ item }}
12
+    fi
13
+  loop:
14
+    - artifacts
15
+    - docs

Loading…
Cancel
Save