Skip to content

Commit

Permalink
Add checking for deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
moarychan authored and stliu committed Sep 4, 2023
1 parent b61f508 commit b4330bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
12 changes: 4 additions & 8 deletions infra/scripts/check-provision-state.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ $asaServiceName = $env:ASA_SERVICE_NAME

# Fail fast the deployment if envs are empty
if (!$subscriptionId) {
Write-Error "The subscription Id is not successfully retrieved, please retry another deployment."
exit 1
throw "The subscription Id is not successfully retrieved, please retry another deployment."
}
if (!$resourceGroup) {
Write-Error "The resource group is not successfully retrieved, please retry another deployment."
exit 1
throw "The resource group is not successfully retrieved, please retry another deployment."
}
if (!$asaServiceName) {
Write-Error "The Azure Spring Apps service name is not successfully retrieved, please retry another deployment."
exit 1
throw "The Azure Spring Apps service name is not successfully retrieved, please retry another deployment."
}

$apiUrl = 'https://management.azure.com/subscriptions/' + $subscriptionId + '/resourceGroups/' + $resourceGroup + '/providers/Microsoft.AppPlatform/Spring/' + $asaServiceName + '/buildServices/default/builders/default?api-version=2023-05-01-preview'
Expand All @@ -41,6 +38,5 @@ while ($sw.Elapsed -lt $timeout) {
}
Write-Output "State: $state"
if ($state -ne $Succeeded) {
Write-Error "The Build Service Builder provisioning state is not succeeded."
exit 1
throw "The Build Service Builder provisioning state is not succeeded."
}
15 changes: 14 additions & 1 deletion infra/scripts/deploy-jar-to-asa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@ do
deployJar $item &
done

wait
jobs_count=$(jobs -p | wc -l)

# Loop until all jobs are done
while [ $jobs_count -gt 0 ]; do
wait -n
exit_status=$?

if [ $exit_status -ne 0 ]; then
echo "One of the deployment failed with exit status $exit_status"
exit $exit_status
else
jobs_count=$((jobs_count - 1))
fi
done

echo "Deployed to Azure Spring Cloud successfully."

Expand Down

0 comments on commit b4330bf

Please sign in to comment.