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

This commit is contained in:
Zuul 2019-01-11 22:07:09 +00:00 committed by Gerrit Code Review
commit 21ea7e8384
2 changed files with 29 additions and 0 deletions

View 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.

View 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