Skip to content

Commit 344748c

Browse files
authored
feat: added deploymentOverview check for provisioning wait (#92)
* feat: added deploymentOverview check for provisioning wait * refactor: simplified as we will see null for all of them for the condition * feat: add default value when not found to use with conditional
1 parent 3d11e7c commit 344748c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

deploy.sh

+13-6
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,26 @@ function pollForSpecificDeployment() {
5151

5252
while true; do
5353
RESPONSE=$(getSpecificDeployment "$1")
54-
FAILED_COUNT=$(echo "$RESPONSE" | jq -r '.deploymentInfo.deploymentOverview.Failed')
54+
FAILED_COUNT=$(echo "$RESPONSE" | jq -r '.deploymentInfo.deploymentOverview.Failed // "?"')
5555
IN_PROGRESS_COUNT=$(echo "$RESPONSE" | jq -r '.deploymentInfo.deploymentOverview.InProgress')
5656
SKIPPED_COUNT=$(echo "$RESPONSE" | jq -r '.deploymentInfo.deploymentOverview.Skipped')
5757
SUCCESS_COUNT=$(echo "$RESPONSE" | jq -r '.deploymentInfo.deploymentOverview.Succeeded')
5858
PENDING_COUNT=$(echo "$RESPONSE" | jq -r '.deploymentInfo.deploymentOverview.Pending')
5959
STATUS=$(echo "$RESPONSE" | jq -r '.deploymentInfo.status')
6060

6161
echo -e "${ORANGE}Deployment in progress. Sleeping 15 seconds. (Try $((++deadlockCounter)))";
62-
echo -e "Instance Overview: ${RED}Failed ($FAILED_COUNT), ${BLUE}In-Progress ($IN_PROGRESS_COUNT), ${RESET_TEXT}Skipped ($SKIPPED_COUNT), ${BLUE}Pending ($PENDING_COUNT), ${GREEN}Succeeded ($SUCCESS_COUNT)"
63-
echo -e "Deployment Status: $STATUS"
6462

65-
if [ "$FAILED_COUNT" -gt 0 ]; then
66-
echo -e "${RED}Failed instance detected (Failed count over zero)."
67-
exit 1;
63+
if [ "$FAILED_COUNT" == "?" ]; then
64+
echo -e "Instance Overview: ${ORANGE}Currently Provisioning..."
65+
echo -e "Deployment Status: $STATUS"
66+
else
67+
echo -e "Instance Overview: ${RED}Failed ($FAILED_COUNT), ${BLUE}In-Progress ($IN_PROGRESS_COUNT), ${RESET_TEXT}Skipped ($SKIPPED_COUNT), ${BLUE}Pending ($PENDING_COUNT), ${GREEN}Succeeded ($SUCCESS_COUNT)"
68+
echo -e "Deployment Status: $STATUS"
69+
70+
if [ "$FAILED_COUNT" -gt 0 ]; then
71+
echo -e "${RED}Failed instance detected (Failed count over zero)."
72+
exit 1;
73+
fi
6874
fi
6975

7076
if [ "$STATUS" = "Failed" ]; then
@@ -80,6 +86,7 @@ function pollForSpecificDeployment() {
8086
echo -e "${RED}Max polling iterations reached (max_polling_iterations)."
8187
exit 1;
8288
fi
89+
8390
sleep 15s;
8491
done;
8592
}

0 commit comments

Comments
 (0)