-
Notifications
You must be signed in to change notification settings - Fork 1.4k
{CI} Add status check for extension release pipeline #9183
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ jobs: | |
client-id: ${{ secrets.ADO_SP_ClientID }} | ||
tenant-id: ${{ secrets.ADO_SP_TenantID }} | ||
allow-no-subscriptions: true | ||
- name: Azure CLI | ||
- name: Trigger ADO Pipeline and Wait for Completion | ||
uses: azure/cli@v2 | ||
env: | ||
ado-org: ${{secrets.ADO_ORGANIZATION}} | ||
|
@@ -35,4 +35,61 @@ jobs: | |
commit-id: ${{ github.sha }} | ||
with: | ||
inlineScript: | | ||
az pipelines build queue --definition-id ${{ env.ado-pipeline-id }} --organization ${{ env.ado-org }} --project ${{ env.ado-project }} --variables commit_id=${{ env.commit-id }} | ||
# Trigger the pipeline and capture the build ID | ||
echo "Triggering ADO pipeline..." | ||
BUILD_RESULT=$(az pipelines build queue \ | ||
--definition-id ${{ env.ado-pipeline-id }} \ | ||
--organization ${{ env.ado-org }} \ | ||
--project ${{ env.ado-project }} \ | ||
--variables commit_id=${{ env.commit-id }} \ | ||
--output json) | ||
|
||
BUILD_ID=$(echo $BUILD_RESULT | jq -r '.id') | ||
echo "Pipeline triggered with Build ID: $BUILD_ID" | ||
|
||
if [ "$BUILD_ID" = "null" ] || [ -z "$BUILD_ID" ]; then | ||
echo "Failed to get build ID from pipeline trigger" | ||
exit 1 | ||
fi | ||
|
||
# Wait for the build to complete | ||
echo "Waiting for build $BUILD_ID to complete..." | ||
while true; do | ||
BUILD_JSON=$(az pipelines build show \ | ||
--id $BUILD_ID \ | ||
--organization ${{ env.ado-org }} \ | ||
--project ${{ env.ado-project }} \ | ||
--output json) | ||
Comment on lines
+58
to
+62
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. The Azure CLI command lacks error handling. If the API call fails (network issues, authentication problems, etc.), the script will continue with potentially invalid JSON, leading to unexpected behavior in subsequent jq operations. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
|
||
BUILD_STATUS=$(echo "$BUILD_JSON" | jq -r '.status') | ||
BUILD_RESULT_STATUS=$(echo "$BUILD_JSON" | jq -r '.result // "none"') | ||
|
||
echo "Current status: $BUILD_STATUS, Result: $BUILD_RESULT_STATUS" | ||
|
||
# Check if build is completed | ||
if [ "$BUILD_STATUS" = "completed" ]; then | ||
echo "Build completed with result: $BUILD_RESULT_STATUS" | ||
|
||
# Check if the build was successful | ||
if [ "$BUILD_RESULT_STATUS" = "succeeded" ]; then | ||
echo "✅ ADO pipeline build succeeded!" | ||
exit 0 | ||
elif [ "$BUILD_RESULT_STATUS" = "partiallySucceeded" ]; then | ||
echo "⚠️ ADO pipeline build partially succeeded" | ||
exit 1 | ||
else | ||
echo "❌ ADO pipeline build failed with result: $BUILD_RESULT_STATUS" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check for other terminal states | ||
if [ "$BUILD_STATUS" = "cancelling" ] || [ "$BUILD_STATUS" = "cancelled" ]; then | ||
echo "❌ ADO pipeline build was cancelled" | ||
exit 1 | ||
fi | ||
|
||
# Wait 60 seconds before checking again | ||
echo "Build still running... waiting 60 seconds" | ||
sleep 60 | ||
done |
This file was deleted.
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.
The infinite while loop lacks a timeout mechanism. Consider adding a maximum wait time or iteration limit to prevent the workflow from running indefinitely if the ADO pipeline becomes stuck or unresponsive.
Copilot uses AI. Check for mistakes.