Add role to move docs and artifacts to log root
When we're operating in the context of a change, we'd like to upload artifacts and docs to the log server so that people can iterate on them before publication safely. Add a role which is intended to be run after fetch-output that moves the content on the executor so that normal log upload concepts can be applied. Change-Id: I1791d1283a0c1f112958db8861526145abe1357c
This commit is contained in:
parent
0630797da8
commit
a441d749b8
14
roles/merge-output-to-logs/README.rst
Normal file
14
roles/merge-output-to-logs/README.rst
Normal file
@ -0,0 +1,14 @@
|
||||
Put artifacts and docs into the executor log dir
|
||||
|
||||
.. note::
|
||||
|
||||
This role only works in a trusted context. It is intended to
|
||||
be used in the post playbook of a base job.
|
||||
|
||||
This role moves artifacts and docs into the logs dir when
|
||||
``zuul.change`` is defined so that they can be uploaded to the
|
||||
log server for developer preview and validation.
|
||||
|
||||
Artifacts and docs are left in place when ``zuul.change`` is
|
||||
not defined so that normal publication jobs can publish them
|
||||
to final locations.
|
15
roles/merge-output-to-logs/tasks/main.yaml
Normal file
15
roles/merge-output-to-logs/tasks/main.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
- name: Move artifacts and docs to logs dir
|
||||
when: zuul.change is defined
|
||||
delegate_to: localhost
|
||||
shell: |
|
||||
if ! $(ls {{ zuul.executor.work_root }}/{{ item }}) ; then
|
||||
# Only create target directory if it is needed.
|
||||
# Do not fail if it is already there.
|
||||
mkdir -p {{ zuul.executor.log_root }}/{{ item }}
|
||||
# Leave the original directory behind so that other roles
|
||||
# operating on the interface directories can simply no-op.
|
||||
mv -f {{ zuul.executor.work_root }}/{{ item }}/* {{ zuul.executor.log_root }}/{{ item }}
|
||||
fi
|
||||
loop:
|
||||
- artifacts
|
||||
- docs
|
Loading…
Reference in New Issue
Block a user