Skip to content

Commit aeb203e

Browse files
Bar MagneziBar Magnezi
authored andcommitted
fix
1 parent 8316c2d commit aeb203e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/commands/trigger-workflows-for-all-modified.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)