Skip to content

Commit e8d520c

Browse files
committed
update
1 parent 969bb21 commit e8d520c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.circleci/wait-for-job-finish.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ counter=0
1313

1414
# Wait up to 25 minutes for job to finish. A job can run on multiple nodes: parallelism > 1
1515
while [ "$counter" -le 1500 ]; do
16-
# Find number of nodes in running or queued
17-
build_detail=$(curl -s "https://circleci.com/api/v2/project/github/DataBiosphere/terra-ui/job/$CIRCLE_BUILD_NUM")
16+
# Find number of nodes in running
17+
job_detail=$(curl -s "https://circleci.com/api/v2/project/github/DataBiosphere/terra-ui/job/$CIRCLE_BUILD_NUM")
1818

19-
running_vm=$(echo "$build_detail" | jq -r --arg INDX "$CIRCLE_NODE_INDEX" '.parallel_runs[] | select(.status=="running") | select(.index|tostring!=$INDX)')
19+
# First, check the response for valid job json
20+
runs=$(echo "$job_detail" | jq -r '.parallel_runs[]')
21+
running_vm=$(echo "$runs" | jq -r 'select(.status=="running")')
2022
count=$(echo "$running_vm" | grep -c -e "running" || test $? = 1;)
2123
if [ "$count" -eq 0 ]; then
2224
echo "Parallel runs have finished. Exiting wait-for-job-finish script."
25+
echo "$runs"
2326
exit 0
2427
fi
2528

0 commit comments

Comments
 (0)