Skip to content

Commit 2803e48

Browse files
Merge branch 'main' into dev
2 parents 32ebef3 + f6b565a commit 2803e48

File tree

3 files changed

+1564
-5589
lines changed

3 files changed

+1564
-5589
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,53 @@ jobs:
2929
- name: Checkout code
3030
uses: actions/checkout@v4
3131

32+
# Run Quota Check Script
33+
- name: Run Quota Check
34+
id: quota-check
35+
run: |
36+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
37+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
38+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
39+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
40+
export GPT_MIN_CAPACITY="30"
41+
export TEXT_EMBEDDING_MIN_CAPACITY="30"
42+
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
43+
44+
chmod +x scripts/checkquota.sh
45+
if ! scripts/checkquota.sh; then
46+
# If quota check fails due to insufficient quota, set the flag
47+
if grep -q "No region with sufficient quota found" scripts/checkquota.sh; then
48+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
49+
fi
50+
exit 1 # Fail the pipeline if any other failure occurs
51+
fi
52+
53+
- name: Send Notification on Quota Failure
54+
if: env.QUOTA_FAILED == 'true'
55+
run: |
56+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
57+
EMAIL_BODY=$(cat <<EOF
58+
{
59+
"body": "<p>Dear Team,</p><p>The quota check has failed, and the pipeline cannot proceed.</p><p><strong>Build URL:</strong> ${RUN_URL}</p><p>Please take necessary action.</p><p>Best regards,<br>Your Automation Team</p>"
60+
}
61+
EOF
62+
)
63+
64+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
65+
-H "Content-Type: application/json" \
66+
-d "$EMAIL_BODY" || echo "Failed to send notification"
67+
68+
- name: Fail Pipeline if Quota Check Fails
69+
if: env.QUOTA_FAILED == 'true'
70+
run: exit 1
71+
72+
# The pipeline stops here if quota check fails!
73+
74+
- name: Set Deployment Region
75+
run: |
76+
echo "Selected Region: $VALID_REGION"
77+
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
78+
3279
- name: Login to GitHub Container Registry
3380
uses: docker/login-action@v3
3481
with:
@@ -51,7 +98,7 @@ jobs:
5198
uses: devcontainers/[email protected]
5299
env:
53100
AZURE_ENV_NAME: ${{ github.run_id }}
54-
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
101+
AZURE_LOCATION: ${{ env.AZURE_LOCATION }}
55102
with:
56103
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
57104
cacheFrom: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator

0 commit comments

Comments
 (0)