Skip to content

Commit 670488d

Browse files
fix: ci workflow fix for Bicep deployment (#1460)
1 parent b587b98 commit 670488d

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
schedule:
8+
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
79

810
permissions:
911
contents: read
@@ -37,6 +39,7 @@ jobs:
3739
env:
3840
AZURE_ENV_NAME: ${{ github.run_id }}
3941
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
42+
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
4043
with:
4144
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
4245
cacheFrom: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
@@ -49,13 +52,15 @@ jobs:
4952
AZURE_SUBSCRIPTION_ID
5053
AZURE_ENV_NAME
5154
AZURE_LOCATION
55+
AZURE_RESOURCE_GROUP
5256
5357
- name: Tidy up
5458
uses: devcontainers/ci@v0.3
5559
if: always()
5660
env:
5761
AZURE_ENV_NAME: ${{ github.run_id }}
5862
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
63+
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
5964
with:
6065
push: never
6166
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
@@ -67,3 +72,22 @@ jobs:
6772
AZURE_SUBSCRIPTION_ID
6873
AZURE_ENV_NAME
6974
AZURE_LOCATION
75+
AZURE_RESOURCE_GROUP
76+
77+
- name: Send Notification on Failure
78+
if: failure()
79+
run: |
80+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
81+
82+
# Construct the email body
83+
EMAIL_BODY=$(cat <<EOF
84+
{
85+
"body": "<p>Dear Team,</p><p>We would like to inform you that the CWYD 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>"
86+
}
87+
EOF
88+
)
89+
90+
# Send the notification
91+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
92+
-H "Content-Type: application/json" \
93+
-d "$EMAIL_BODY" || echo "Failed to send notification"

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,14 @@ azd-login: ## 🔑 Login to Azure with azd and a SPN
5757
@echo -e "\e[34m$@\e[0m" || true
5858
@azd auth login --client-id ${AZURE_CLIENT_ID} --client-secret ${AZURE_CLIENT_SECRET} --tenant-id ${AZURE_TENANT_ID}
5959

60-
deploy: azd-login ## 🚀 Deploy everything to Azure
60+
az-login: ## 🔑 Login to Azure with az and a SPN
61+
az login --service-principal -u ${AZURE_CLIENT_ID} -p ${AZURE_CLIENT_SECRET} --tenant ${AZURE_TENANT_ID}
62+
63+
deploy: azd-login az-login ## 🚀 Deploy everything to Azure
6164
@echo -e "\e[34m$@\e[0m" || true
6265
@azd env new ${AZURE_ENV_NAME}
6366
@azd env set AZURE_APP_SERVICE_HOSTING_MODEL code --no-prompt
67+
@az group create --name ${AZURE_RESOURCE_GROUP} --location ${AZURE_LOCATION}
6468
@azd provision --no-prompt
6569
@azd deploy web --no-prompt
6670
@azd deploy function --no-prompt

0 commit comments

Comments
 (0)