Skip to content

Commit a8a5665

Browse files
Merge pull request #155 from microsoft/dev
feat: Merging the changes from dev to main
2 parents 40b870a + cf8d934 commit a8a5665

File tree

9 files changed

+41258
-47
lines changed

9 files changed

+41258
-47
lines changed

.github/workflows/deploy.yml

Lines changed: 73 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,43 @@ jobs:
3636
run: |
3737
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
3838
39+
- name: Run Quota Check
40+
id: quota-check
41+
run: |
42+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
43+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
44+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
45+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
46+
export GPT_MIN_CAPACITY="${{ env.GPT_MIN_CAPACITY }}"
47+
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
48+
chmod +x scripts/checkquota.sh
49+
if ! scripts/checkquota.sh; then
50+
# If quota check fails due to insufficient quota, set the flag
51+
if grep -q "No region with sufficient quota found" scripts/checkquota.sh; then
52+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
53+
fi
54+
exit 1 # Fail the pipeline if any other failure occurs
55+
fi
56+
57+
- name: Send Notification on Quota Failure
58+
if: env.QUOTA_FAILED == 'true'
59+
run: |
60+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
61+
EMAIL_BODY=$(cat <<EOF
62+
{
63+
"body": "<p>Dear Team,</p><p>The quota check has failed, and the pipeline cannot proceed.</p><p><strong>Build URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a></p><p>Please take necessary action.</p><p>Best regards,<br>Your Automation Team</p>"
64+
}
65+
EOF
66+
)
67+
68+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
69+
-H "Content-Type: application/json" \
70+
-d "$EMAIL_BODY" || echo "Failed to send notification"
71+
72+
- name: Fail Pipeline if Quota Check Fails
73+
if: env.QUOTA_FAILED == 'true'
74+
run: exit 1
75+
3976
- name: Install Bicep CLI
4077
run: az bicep install
4178

@@ -94,11 +131,11 @@ jobs:
94131
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
95132
--template-file infra/main.bicep \
96133
--parameters \
97-
Prefix="${{ env.SOLUTION_PREFIX }}" \
134+
solutionName="${{ env.SOLUTION_PREFIX }}" \
98135
aiDeploymentsLocation="eastus" \
136+
useWafAlignedArchitecture=false \
99137
capacity=${{ env.GPT_MIN_CAPACITY }} \
100-
imageVersion="${IMAGE_TAG}"\
101-
--debug
138+
imageVersion="${IMAGE_TAG}"
102139
103140
- name: Get Deployment Output and extract Values
104141
id: get_output
@@ -111,24 +148,6 @@ jobs:
111148
echo "WEBAPP_URL=$WEBAPP_URL" >> $GITHUB_OUTPUT
112149
echo "Deployment output: $BICEP_OUTPUT"
113150
114-
- name: Send Notification on Failure
115-
if: failure()
116-
run: |
117-
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
118-
119-
# Construct the email body
120-
EMAIL_BODY=$(cat <<EOF
121-
{
122-
"body": "<p>Dear Team,</p><p>We would like to inform you that the Modernize-your-code-solution-accelerator Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
123-
}
124-
EOF
125-
)
126-
127-
# Send the notification
128-
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
129-
-H "Content-Type: application/json" \
130-
-d "$EMAIL_BODY" || echo "Failed to send notification"
131-
132151
- name: Logout from Azure
133152
if: always()
134153
run: |
@@ -171,7 +190,6 @@ jobs:
171190
172191
if [ -z "$log_analytics_workspace_name" ]; then
173192
echo "No Log Analytics workspace found in resource group ${{ env.RESOURCE_GROUP_NAME }}."
174-
exit 1
175193
else
176194
echo "LOG_ANALYTICS_WORKSPACE_NAME=${log_analytics_workspace_name}" >> $GITHUB_ENV
177195
echo "Log Analytics workspace name: ${log_analytics_workspace_name}"
@@ -224,22 +242,6 @@ jobs:
224242
echo "KEYVAULTS=$keyvault_array" >> $GITHUB_ENV
225243
fi
226244
227-
- name: Purge log analytics workspace
228-
if: always()
229-
id: log_analytics_workspace
230-
run: |
231-
232-
set -e
233-
# Purge Log Analytics Workspace
234-
echo "Purging the Log Analytics Workspace..."
235-
if ! az monitor log-analytics workspace delete --force --resource-group ${{ env.RESOURCE_GROUP_NAME }} --workspace-name ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }} --yes --verbose; then
236-
echo "Failed to purge Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
237-
else
238-
echo "Purged the Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
239-
fi
240-
241-
echo "Log analytics workspace resource purging completed successfully"
242-
243245
- name: Delete Bicep Deployment
244246
if: always()
245247
run: |
@@ -257,6 +259,23 @@ jobs:
257259
echo "Resource group does not exists."
258260
fi
259261
262+
- name: Purge log analytics workspace
263+
if: always()
264+
id: log_analytics_workspace
265+
run: |
266+
267+
set -e
268+
# Purge Log Analytics Workspace
269+
echo "Purging the Log Analytics Workspace..."
270+
if ! az monitor log-analytics workspace delete --force --resource-group ${{ env.RESOURCE_GROUP_NAME }} --workspace-name ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }} --yes --verbose; then
271+
echo "Failed to purge Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
272+
else
273+
echo "Purged the Log Analytics workspace: ${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}"
274+
fi
275+
276+
echo "Log analytics workspace resource purging completed successfully"
277+
278+
260279
- name: Wait for resource deletion to complete
261280
if: always()
262281
run: |
@@ -363,6 +382,22 @@ jobs:
363382
done
364383
echo "Resource purging completed successfully"
365384
385+
- name: Send Notification on Failure
386+
if: failure() || needs.deploy.result == 'failure'
387+
run: |
388+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
389+
390+
EMAIL_BODY=$(cat <<EOF
391+
{
392+
"body": "<p>Dear Team,</p><p>We would like to inform you that the DocGen Deployment Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> <a href=\"${RUN_URL}\">${RUN_URL}</a><br></p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
393+
}
394+
EOF
395+
)
396+
397+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
398+
-H "Content-Type: application/json" \
399+
-d "$EMAIL_BODY" || echo "Failed to send notification"
400+
366401
- name: Logout from Azure
367402
if: always()
368403
run: |

docs/CustomizingAzdParameters.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ By default this template will use the environment name as the prefix to prevent
1717
| `AZURE_ENV_MODEL_CAPACITY` | integer | `200` | Set the Model Capacity (choose a number based on available GPT model capacity in your subscription). |
1818
| `AZURE_ENV_LOG_ANALYTICS_WORKSPACE_ID` | string | `<Existing Workspace Id>` | Set this if you want to reuse an existing Log Analytics Workspace instead of creating a new one. |
1919
| `AZURE_ENV_IMAGETAG` | string | `latest` | Set the Image tag Like (allowed values: latest, dev, hotfix) |
20-
20+
| `AZURE_ENV_JUMPBOX_SIZE` | string | `Standard_DS2_v2` | Specifies the size of the Jumpbox Virtual Machine. Set a custom value if `enablePrivateNetworking` is `true`. |
2121
---
2222

2323
## How to Set a Parameter

infra/main.bicep

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ param secondaryLocation string?
6161
@description('Optional. Enable private networking for the resources. Set to true to enable private networking. Defaults to false.')
6262
param enablePrivateNetworking bool = useWafAlignedArchitecture? true : false
6363

64+
@description('Optional. Size of the Jumpbox Virtual Machine when created. Set to custom value if enablePrivateNetworking is true.')
65+
param vmSize string?
66+
6467
@description('Optional. Admin username for the Jumpbox Virtual Machine. Set to custom value if enablePrivateNetworking is true.')
6568
@secure()
6669
//param vmAdminUsername string = take(newGuid(), 20)
@@ -200,13 +203,15 @@ module applicationInsights 'br/public:avm/res/insights/component:0.6.0' = if (en
200203
}
201204
}
202205

206+
203207
module network 'modules/network.bicep' = if (enablePrivateNetworking) {
204208
name: take('network-${resourcesName}-deployment', 64)
205209
params: {
206210
resourcesName: resourcesName
207211
logAnalyticsWorkSpaceResourceId: logAnalyticsWorkspaceResourceId
208212
vmAdminUsername: vmAdminUsername ?? 'JumpboxAdminUser'
209213
vmAdminPassword: vmAdminPassword ?? 'JumpboxAdminP@ssw0rd1234!'
214+
vmSize: vmSize ?? 'Standard_DS2_v2' // Default VM size
210215
location: location
211216
tags: allTags
212217
enableTelemetry: enableTelemetry
@@ -600,3 +605,4 @@ module containerAppFrontend 'br/public:avm/res/app/container-app:0.17.0' = {
600605

601606
@description('The resource group the resources were deployed into.')
602607
output resourceGroupName string = resourceGroup().name
608+
output WEB_APP_URL string = 'https://${containerAppFrontend.outputs.fqdn}'

0 commit comments

Comments
 (0)