Skip to content

Commit 5f324b1

Browse files
committed
fix: support for multiple running k8-test workflows
1 parent 931f6fe commit 5f324b1

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

gh/db_migration_wait.sh

+13-20
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,19 @@ do
1515
done
1616

1717

18-
RUNNING_DB_UPGRADE_WORKFLOW=""
19-
RUNNING_DB_UPGRADE_WORKFLOW_ID=$(gh run list \
20-
--json conclusion,databaseId,headBranch,status,workflowName \
21-
--jq ".[] | select(.workflowName==\"$WAIT_WORKFLOW_NAME\" and .status!=\"completed\" and .headBranch!=\"$ENVIRONMENT_NAME\" and .databaseId!=$CURRENT_WORKFLOW_DATABASE_ID) | .databaseId" \
22-
--repo code-kern-ai/refinery-gateway)
18+
RUNNING_DB_UPGRADE_WORKFLOW_ID=""
2319

24-
# while [ -z $RUNNING_DB_UPGRADE_WORKFLOW ]; do
25-
# RUNNING_DB_UPGRADE_WORKFLOW=$(gh run list \
26-
# --json conclusion,databaseId,headBranch,status,workflowName \
27-
# --jq '.[] | select(.workflowName=="'$WAIT_WORKFLOW_NAME'" and .status!="completed" and .headBranch!="'$ENVIRONMENT_NAME'" and .databaseId!="'$CURRENT_WORKFLOW_DATABASE_ID'")' \
28-
# --repo code-kern-ai/refinery-gateway)
29-
# echo "Waiting for running db upgrade workflow to complete ..."
30-
# if [ -z $RUNNING_DB_UPGRADE_WORKFLOW ]; then
31-
# sleep 5
32-
# fi
33-
# done
34-
if [ -z $RUNNING_DB_UPGRADE_WORKFLOW_ID ]; then
35-
echo "No running db upgrade workflow found"
36-
exit 0
37-
fi
3820

39-
gh run watch $RUNNING_DB_UPGRADE_WORKFLOW_ID --repo code-kern-ai/refinery-gateway
21+
while [ -z $RUNNING_DB_UPGRADE_WORKFLOW_ID ]; do
22+
RUNNING_DB_UPGRADE_WORKFLOW_ID=$(gh run list \
23+
--json conclusion,databaseId,headBranch,status,workflowName \
24+
--jq ".[] | select(.workflowName==\"$WAIT_WORKFLOW_NAME\" and .status!=\"completed\" and .headBranch!=\"$ENVIRONMENT_NAME\" and .databaseId!=$CURRENT_WORKFLOW_DATABASE_ID) | .databaseId" \
25+
--repo code-kern-ai/refinery-gateway)
26+
27+
echo "Waiting for running db upgrade workflow to complete ..."
28+
if [ -z $RUNNING_DB_UPGRADE_WORKFLOW_ID ]; then
29+
gh run watch $RUNNING_DB_UPGRADE_WORKFLOW_ID --repo code-kern-ai/refinery-gateway 1> /dev/null
30+
fi
31+
done
32+
4033
echo "::notice::Running db upgrade workflow completed"

0 commit comments

Comments
 (0)