Browse Source

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
changes/92/632092/3
Monty Taylor 6 months ago
parent
commit
f711df6978
No account linked to committer's email address
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      roles/merge-output-to-logs/tasks/main.yaml

+ 2
- 1
roles/merge-output-to-logs/tasks/main.yaml View File

@@ -2,7 +2,7 @@
2 2
   when: zuul.change is defined
3 3
   delegate_to: localhost
4 4
   shell: |
5
-    if ! $(ls {{ zuul.executor.work_root }}/{{ item }}) ; then
5
+    if [ -n $(ls {{ zuul.executor.work_root }}/{{ item }}) ] ; then
6 6
       # Only create target directory if it is needed.
7 7
       # Do not fail if it is already there.
8 8
       mkdir -p {{ zuul.executor.log_root }}/{{ item }}
@@ -13,3 +13,4 @@
13 13
   loop:
14 14
     - artifacts
15 15
     - docs
16
+  run_once: true

Loading…
Cancel
Save