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:
Monty Taylor 2019-01-09 17:02:16 +00:00
parent 0630797da8
commit a441d749b8
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
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