File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -268,9 +268,7 @@ steps:
268268 workflow_id=$(jq -r .id /tmp/swissknife/triggered_workflow.json)
269269 echo ""
270270 echo "Waiting for workflow: ${workflow_id} to complete"
271- if (( $total == 0 )); then
272- sleep << parameters.sleep-time-between-checks >>
273- fi
271+ total_wait_time=0
274272
275273 while true; do
276274 workflow_status=/tmp/swissknife/workflow_status.json
@@ -291,12 +289,13 @@ steps:
291289 running=$(jq -s 'map(select(.status == "running")) | length' ${workflow_status})
292290 success=$(jq -s 'map(select(.status == "success")) | length' ${workflow_status})
293291 echo "total: ${total}, running: ${running}, success: ${success}"
294- if (( $total == 0 )); then
292+ if (( $total == 0 && $total_wait_time > 0 )); then
295293 echo "No running workflows, return success"
296294 exit 0
297- elif (( $running > 0 )); then
295+ elif (( $total_wait_time == 0 || $ running > 0 )); then
298296 echo "Going to sleep for << parameters.sleep-time-between-checks >>"
299297 sleep << parameters.sleep-time-between-checks >>
298+ total_wait_time=$((total_wait_time+<< parameters.sleep-time-between-checks >>))
300299 elif (( $total == $success )); then
301300 echo "Great success"
302301 exit 0
You can’t perform that action at this time.
0 commit comments