Fix concurrency and syntax issue in merge-output-to-logs

In a multi-node job, these mv commands run in parallel which makes
the second invocation weird and racy (even though there is a mv -f
there) Put in run_once - we don't need to perform this more than
one time, no matter how many nodes there are in the nodeset.

Also, when there are actually files present, if ! $(ls work_dir/*)
winds up expanding as a command to be run.

Change-Id: Ia59c604d6639fab762fae5e53790da8992437587
This commit is contained in:
Monty Taylor 2019-01-21 13:45:41 +00:00
parent c0a1ebb310
commit f711df6978
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 2 additions and 1 deletions

View File

@ -2,7 +2,7 @@
when: zuul.change is defined
delegate_to: localhost
shell: |
if ! $(ls {{ zuul.executor.work_root }}/{{ item }}) ; then
if [ -n $(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 }}
@ -13,3 +13,4 @@
loop:
- artifacts
- docs
run_once: true