Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
aweng98 committed May 15, 2024
1 parent 969bb21 commit e8d520c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .circleci/wait-for-job-finish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ counter=0

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

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

Expand Down

0 comments on commit e8d520c

Please sign in to comment.