Skip to content

Commit 49c6b68

Browse files
Update email format
1 parent b22ea8d commit 49c6b68

4 files changed

Lines changed: 294 additions & 24 deletions

File tree

.github/workflows/validate-bicep-params.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ jobs:
3333
- name: Validate infra/ parameters
3434
id: validate_infra
3535
continue-on-error: true
36+
env:
37+
ACCELERATOR_NAME: ${{ env.accelerator_name }}
3638
run: |
3739
set +e
38-
python scripts/validate_bicep_params.py --dir infra --strict --no-color --json-output infra_results.json 2>&1 | tee infra_output.txt
40+
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
41+
python scripts/validate_bicep_params.py --dir infra --strict --no-color \
42+
--json-output infra_results.json \
43+
--html-output email_body.html \
44+
--accelerator-name "${ACCELERATOR_NAME}" \
45+
--run-url "${RUN_URL}" 2>&1 | tee infra_output.txt
3946
EXIT_CODE=${PIPESTATUS[0]}
4047
set -e
4148
echo "## Infra Param Validation" >> "$GITHUB_STEP_SUMMARY"
@@ -60,24 +67,21 @@ jobs:
6067
name: bicep-validation-results
6168
path: |
6269
infra_results.json
70+
email_body.html
6371
retention-days: 30
6472

6573
- name: Send schedule notification on failure
6674
if: github.event_name == 'schedule' && steps.result.outputs.status == 'failure'
6775
env:
6876
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
69-
GITHUB_REPOSITORY: ${{ github.repository }}
70-
GITHUB_RUN_ID: ${{ github.run_id }}
7177
ACCELERATOR_NAME: ${{ env.accelerator_name }}
7278
run: |
73-
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
74-
INFRA_OUTPUT=$(sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' infra_output.txt)
79+
EMAIL_BODY=$(cat email_body.html)
7580
7681
jq -n \
7782
--arg name "${ACCELERATOR_NAME}" \
78-
--arg infra "$INFRA_OUTPUT" \
79-
--arg url "$RUN_URL" \
80-
'{subject: ("Bicep Parameter Validation Report - " + $name + " - Issues Detected"), body: ("<p>Dear Team,</p><p>The scheduled <strong>Bicep Parameter Validation</strong> for <strong>" + $name + "</strong> has detected parameter mapping errors.</p><p><strong>infra/ Results:</strong></p><pre>" + $infra + "</pre><p><strong>Run URL:</strong> <a href=\"" + $url + "\">" + $url + "</a></p><p>Please fix the parameter mapping issues at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>")}' \
83+
--arg body "$EMAIL_BODY" \
84+
'{subject: ("Bicep Parameter Validation Report - " + $name + " - Issues Detected"), body: $body}' \
8185
| curl -X POST "${LOGICAPP_URL}" \
8286
-H "Content-Type: application/json" \
8387
-d @- || echo "Failed to send notification"
@@ -86,18 +90,14 @@ jobs:
8690
if: github.event_name == 'schedule' && steps.result.outputs.status == 'success'
8791
env:
8892
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
89-
GITHUB_REPOSITORY: ${{ github.repository }}
90-
GITHUB_RUN_ID: ${{ github.run_id }}
9193
ACCELERATOR_NAME: ${{ env.accelerator_name }}
9294
run: |
93-
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
94-
INFRA_OUTPUT=$(sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' infra_output.txt)
95+
EMAIL_BODY=$(cat email_body.html)
9596
9697
jq -n \
9798
--arg name "${ACCELERATOR_NAME}" \
98-
--arg infra "$INFRA_OUTPUT" \
99-
--arg url "$RUN_URL" \
100-
'{subject: ("Bicep Parameter Validation Report - " + $name + " - Passed"), body: ("<p>Dear Team,</p><p>The scheduled <strong>Bicep Parameter Validation</strong> for <strong>" + $name + "</strong> has completed successfully. All parameter mappings are valid.</p><p><strong>infra/ Results:</strong></p><pre>" + $infra + "</pre><p><strong>Run URL:</strong> <a href=\"" + $url + "\">" + $url + "</a></p><p>Best regards,<br>Your Automation Team</p>")}' \
99+
--arg body "$EMAIL_BODY" \
100+
'{subject: ("Bicep Parameter Validation Report - " + $name + " - Passed"), body: $body}' \
101101
| curl -X POST "${LOGICAPP_URL}" \
102102
-H "Content-Type: application/json" \
103103
-d @- || echo "Failed to send notification"

infra/main.parameters.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
"value": "${AZURE_ENV_NAME}"
77
},
88
"location": {
9-
"value": "${AZURE_LOCATION}"
9+
"value": "${AZURE_LOCATION23}"
1010
},
1111
"deploymentType": {
1212
"value": "${AZURE_ENV_MODEL_DEPLOYMENT_TYPE}"
1313
},
14-
"gptModelName": {
14+
"gptModelNa23me": {
1515
"value": "${AZURE_ENV_GPT_MODEL_NAME}"
1616
},
17-
"gptDeploymentCapacity": {
17+
"gptDeploymentCapacity23": {
1818
"value": "${AZURE_ENV_GPT_MODEL_CAPACITY}"
1919
},
2020
"gptModelVersion": {
21-
"value": "${AZURE_ENV_GPT_MODEL_VERSION}"
21+
"value": "${AZURE_ENV_GPT_MODEL_VERSION23}"
2222
},
2323
"imageTag": {
2424
"value": "${AZURE_ENV_IMAGE_TAG=latest}"

infra/main.waf.parameters.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"value": "${AZURE_ENV_NAME}"
77
},
88
"location": {
9-
"value": "${AZURE_LOCATION}"
9+
"value": "${AZURE_LOCATION23}"
1010
},
1111
"deploymentType": {
1212
"value": "${AZURE_ENV_MODEL_DEPLOYMENT_TYPE}"
@@ -15,15 +15,15 @@
1515
"value": "${AZURE_ENV_GPT_MODEL_NAME}"
1616
},
1717
"gptDeploymentCapacity": {
18-
"value": "${AZURE_ENV_GPT_MODEL_CAPACITY}"
18+
"value": "${AZURE_ENV_GPT_MODEL_CAPACITY23}"
1919
},
20-
"gptModelVersion": {
20+
"gptModelVersdssion": {
2121
"value": "${AZURE_ENV_GPT_MODEL_VERSION}"
2222
},
2323
"imageTag": {
2424
"value": "${AZURE_ENV_IMAGE_TAG=latest}"
2525
},
26-
"containerRegistryEndpoint": {
26+
"containerRegistryEndpoint23": {
2727
"value": "${AZURE_ENV_CONTAINER_REGISTRY_ENDPOINT=cmsacontainerreg.azurecr.io}"
2828
},
2929
"existingLogAnalyticsWorkspaceId": {
@@ -41,7 +41,7 @@
4141
"vmSize": {
4242
"value": "${AZURE_ENV_VM_SIZE}"
4343
},
44-
"vmAdminUsername": {
44+
"vmAdminUsername2323": {
4545
"value": "${AZURE_ENV_VM_ADMIN_USERNAME}"
4646
},
4747
"vmAdminPassword": {

0 commit comments

Comments
 (0)