zuul-jobs/roles/merge-output-to-logs/tasks/main.yaml
Monty Taylor 3b9e295a37
Use find instead of ls for determining dir emptiness
ls foo/* isn't a great way to do this - but find, as is usually
the case, solves all problems.

Change-Id: Ic30b36ccee41e9b74e187eb3cdab0359f659a1c9
2019-01-21 17:24:51 +00:00

17 lines
631 B
YAML

- name: Move artifacts and docs to logs dir
when: zuul.change is defined
delegate_to: localhost
shell: |
if [ -n "$(find {{ zuul.executor.work_root }}/{{ item }} -mindepth 1)" ] ; 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
run_once: true