Skip to content

Commit 25db525

Browse files
{CI} Add a test workflow to trigger test extension release pipeline on main branch push (#9158)
* Add workflow to trigger Test Extension Release Pipeline on main branch push * Add a test pipeline to perform a dry run release of new external extension wheel packages to the unified AME storage account. * Update .github/workflows/TestTriggerExtensionRelease.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9010334 commit 25db525

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Trigger ADO OneBranch Extension Release Pipeline
2+
3+
# Run this workflow every time a commit gets pushed to main
4+
# This triggers the ADO OneBranch Extension Release Pipeline
5+
on:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
id-token: write
13+
14+
jobs:
15+
build:
16+
name: Trigger Extension Release Pipeline
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
21+
with:
22+
egress-policy: audit
23+
- name: Azure login
24+
uses: azure/login@v2
25+
with:
26+
client-id: ${{ secrets.ADO_SP_ClientID }}
27+
tenant-id: ${{ secrets.ADO_SP_TenantID }}
28+
allow-no-subscriptions: true
29+
- name: Trigger ADO Pipeline and Wait for Completion
30+
uses: azure/cli@v2
31+
env:
32+
ado-org: ${{secrets.ADO_ORGANIZATION}}
33+
ado-project: ${{secrets.ADO_PROJECT}}
34+
ado-pipeline-id: 396380
35+
commit-id: ${{ github.sha }}
36+
with:
37+
inlineScript: |
38+
# Trigger the pipeline and capture the build ID
39+
echo "Triggering ADO pipeline..."
40+
BUILD_RESULT=$(az pipelines build queue \
41+
--definition-id ${{ env.ado-pipeline-id }} \
42+
--organization ${{ env.ado-org }} \
43+
--project ${{ env.ado-project }} \
44+
--variables commit_id=${{ env.commit-id }} \
45+
--output json)
46+
47+
BUILD_ID=$(echo $BUILD_RESULT | jq -r '.id')
48+
echo "Pipeline triggered with Build ID: $BUILD_ID"
49+
50+
if [ "$BUILD_ID" = "null" ] || [ -z "$BUILD_ID" ]; then
51+
echo "Failed to get build ID from pipeline trigger"
52+
exit 1
53+
fi
54+
55+
# Wait for the build to complete
56+
echo "Waiting for build $BUILD_ID to complete..."
57+
while true; do
58+
BUILD_JSON=$(az pipelines build show \
59+
--id $BUILD_ID \
60+
--organization ${{ env.ado-org }} \
61+
--project ${{ env.ado-project }} \
62+
--output json)
63+
64+
BUILD_STATUS=$(echo "$BUILD_JSON" | jq -r '.status')
65+
BUILD_RESULT_STATUS=$(echo "$BUILD_JSON" | jq -r '.result // "none"')
66+
67+
echo "Current status: $BUILD_STATUS, Result: $BUILD_RESULT_STATUS"
68+
69+
# Check if build is completed
70+
if [ "$BUILD_STATUS" = "completed" ]; then
71+
echo "Build completed with result: $BUILD_RESULT_STATUS"
72+
73+
# Check if the build was successful
74+
if [ "$BUILD_RESULT_STATUS" = "succeeded" ]; then
75+
echo "✅ ADO pipeline build succeeded!"
76+
exit 0
77+
elif [ "$BUILD_RESULT_STATUS" = "partiallySucceeded" ]; then
78+
echo "⚠️ ADO pipeline build partially succeeded"
79+
exit 1
80+
else
81+
echo "❌ ADO pipeline build failed with result: $BUILD_RESULT_STATUS"
82+
exit 1
83+
fi
84+
fi
85+
86+
# Check for other terminal states
87+
if [ "$BUILD_STATUS" = "cancelling" ] || [ "$BUILD_STATUS" = "cancelled" ]; then
88+
echo "❌ ADO pipeline build was cancelled"
89+
exit 1
90+
fi
91+
92+
# Wait 30 seconds before checking again
93+
echo "Build still running... waiting 30 seconds"
94+
sleep 30
95+
done

0 commit comments

Comments
 (0)