Skip to content

Commit 53d5947

Browse files
refactor: update notification messages and improve logout conditions in deployment workflows
1 parent 1b05d52 commit 53d5947

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

.github/workflows/deploy-waf.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
- dev
1515
- demo
1616
schedule:
17-
- cron: "0 11,23 * * *" # Runs at 11:00 AM and 11:00 PM GMT
17+
- cron: "10 11,23 * * *" # Runs at 11:10 AM and 11:10 PM GMT
1818

1919
env:
2020
GPT_MIN_CAPACITY: 150
@@ -58,7 +58,7 @@ jobs:
5858
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
5959
EMAIL_BODY=$(cat <<EOF
6060
{
61-
"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>"
61+
"body": "<p>Dear Team,</p><p>The quota check has failed, and the MACAE WAF 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>"
6262
}
6363
EOF
6464
)
@@ -89,6 +89,7 @@ jobs:
8989
azd version
9090
9191
- name: Login to Azure
92+
id: login-azure
9293
run: |
9394
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
9495
azd auth login --client-id ${{ secrets.AZURE_CLIENT_ID }} --client-secret ${{ secrets.AZURE_CLIENT_SECRET }} --tenant-id ${{ secrets.AZURE_TENANT_ID }}
@@ -199,6 +200,7 @@ jobs:
199200
echo "CONTAINER_APP=${CONTAINER_APP_NAME}" >> $GITHUB_OUTPUT
200201
201202
- name: Logout from Azure
203+
if: always() && steps.login-azure.outcome == 'success'
202204
run: |
203205
az logout
204206
azd auth logout
@@ -258,14 +260,14 @@ jobs:
258260
echo "Deployment deleted successfully."
259261
260262
- name: Send Notification on Failure
261-
if: failure() || needs.deploy.result == 'failure'
263+
if: always() && (failure() || needs.deploy.result == 'failure')
262264
run: |
263265
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
264266
265267
# Construct the email body
266268
EMAIL_BODY=$(cat <<EOF
267269
{
268-
"body": "<p>Dear Team,</p><p>We would like to inform you that the Multi-Agent-Custom-Automation-Engine-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>"
270+
"body": "<p>Dear Team,</p><p>We would like to inform you that the Multi-Agent-Custom-Automation-Engine-Solution-Accelerator (WAF) 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>"
269271
}
270272
EOF
271273
)

.github/workflows/deploy.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
5656
EMAIL_BODY=$(cat <<EOF
5757
{
58-
"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>"
58+
"body": "<p>Dear Team,</p><p>The quota check has failed, and the MACAE 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>"
5959
}
6060
EOF
6161
)
@@ -86,6 +86,7 @@ jobs:
8686
azd version
8787
8888
- name: Login to Azure
89+
id: login-azure
8990
run: |
9091
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
9192
azd auth login --client-id ${{ secrets.AZURE_CLIENT_ID }} --client-secret ${{ secrets.AZURE_CLIENT_SECRET }} --tenant-id ${{ secrets.AZURE_TENANT_ID }}
@@ -189,8 +190,9 @@ jobs:
189190
--query "properties.configuration.ingress.fqdn" -o tsv)
190191
echo "MACAE_URL_API=https://${MACAE_URL_API}" >> $GITHUB_OUTPUT
191192
echo "CONTAINER_APP=${CONTAINER_APP_NAME}" >> $GITHUB_OUTPUT
192-
193+
193194
- name: Logout from Azure
195+
if: always() && steps.login-azure.outcome == 'success'
194196
run: |
195197
az logout
196198
azd auth logout
@@ -250,7 +252,7 @@ jobs:
250252
echo "Deployment deleted successfully."
251253
252254
- name: Send Notification on Failure
253-
if: failure() || needs.deploy.result == 'failure'
255+
if: always() && (failure() || needs.deploy.result == 'failure')
254256
run: |
255257
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
256258

0 commit comments

Comments
 (0)