-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding logic to poll deployment health instead of static wait #1240
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d471156
adding deployment health check
vatsrahul1001 b23c2cc
passing var for KE as well
vatsrahul1001 7a5d1be
fixing pre-commit
vatsrahul1001 9dbcdfb
fixing var name
vatsrahul1001 5f39bd9
fixing invalid syntax
vatsrahul1001 0fc1ed0
formatting fix
vatsrahul1001 189c2d4
update polling time to 1800
vatsrahul1001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,30 +45,25 @@ jobs: | |
run: | | ||
astro_core_api="https://api.astronomer.io/v1alpha1/organizations/${{secrets.organization_id }}/\ | ||
deployments" | ||
tries=60 | ||
tries=15 | ||
health_flag=false | ||
|
||
while [[ $tries -gt 0 && $health_flag == false ]]; do | ||
sleep 120 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think would be good to place this log at the end of the while loop, just to see logs saying Deployment status is different than Healthy and it's waiting for deployment to be healthy in case it becomes healthy in <2 mins. |
||
response=$(curl -s -H "Authorization: Bearer ${{ secrets.bearer_token }}" -X GET \ | ||
"$astro_core_api?deploymentIds=${{ secrets.deployment_id }}") | ||
deployment_status=$(echo "$response" | jq -r '.deployments[0].status') | ||
|
||
echo "Deployment status is: $deployment_status" | ||
echo "Waiting for deployment to be in ready state!!!" | ||
sleep 60 | ||
|
||
if [[ $deployment_status == "HEALTHY" ]]; then | ||
health_flag=true | ||
fi | ||
|
||
tries=$((tries - 1)) | ||
done | ||
|
||
if [[ $health_flag == false ]]; then | ||
echo "Timed out waiting for deployment ${{ secrets.deployment_id }} to be HEALTHY" | ||
exit 1 | ||
fi | ||
|
||
echo "${{ secrets.deployment_id }} is in HEALTHY state now" | ||
|
||
- name: Checkout | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to wait for an hour maybe in some scenarios where it might take longer. So tries=30?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or the previous one would have been fine too. 60 * 60