Skip to content

Commit 28503f7

Browse files
testing automation flow
1 parent c28ab36 commit 28503f7

File tree

1 file changed

+28
-35
lines changed

1 file changed

+28
-35
lines changed

.github/workflows/deploy.yml

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ jobs:
3232
echo "Generating a unique resource group name..."
3333
TIMESTAMP=$(date +%Y%m%d%H%M%S)
3434
COMMON_PART="ci-mycsa"
35-
# UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}"
36-
UNIQUE_RG_NAME="ci-mycsa20250512102836"
35+
UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}"
3736
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
3837
echo "Generated Resource_GROUP_PREFIX: ${UNIQUE_RG_NAME}"
3938
@@ -52,37 +51,37 @@ jobs:
5251
fi
5352
5453
55-
# - name: Deploy Bicep Template
56-
# id: deploy
57-
# run: |
58-
# set -e
59-
# az deployment group create \
60-
# --resource-group ${{ env.RESOURCE_GROUP_NAME }} \
61-
# --template-file infra/main.bicep \
62-
# --parameters AzureAiServiceLocation=northcentralus Prefix=codegen
54+
- name: Deploy Bicep Template
55+
id: deploy
56+
run: |
57+
set -e
58+
az deployment group create \
59+
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
60+
--template-file infra/main.bicep \
61+
--parameters AzureAiServiceLocation=northcentralus Prefix=codegen
6362
6463
65-
# - name: Send Notification on Failure
66-
# if: failure()
67-
# run: |
68-
# RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
64+
- name: Send Notification on Failure
65+
if: failure()
66+
run: |
67+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
6968
70-
# # Construct the email body
71-
# EMAIL_BODY=$(cat <<EOF
72-
# {
73-
# "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>"
74-
# }
75-
# EOF
76-
# )
69+
# Construct the email body
70+
EMAIL_BODY=$(cat <<EOF
71+
{
72+
"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>"
73+
}
74+
EOF
75+
)
7776

78-
# # Send the notification
79-
# curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
80-
# -H "Content-Type: application/json" \
81-
# -d "$EMAIL_BODY" || echo "Failed to send notification"
77+
# Send the notification
78+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
79+
-H "Content-Type: application/json" \
80+
-d "$EMAIL_BODY" || echo "Failed to send notification"
8281

8382

84-
- name: Get Log Analytics Workspace from Resource Group
85-
id: get_log_analytics_workspace
83+
- name: Get Log Analytics Workspace and OpenAI from Resource Group
84+
id: get_azure_resources
8685
run: |
8786
8887
set -e
@@ -98,13 +97,7 @@ jobs:
9897
echo "LOG_ANALYTICS_WORKSPACE_NAME=${log_analytics_workspace_name}" >> $GITHUB_ENV
9998
echo "Log Analytics workspace name: ${log_analytics_workspace_name}"
10099
fi
101-
102-
- name: Get OpenAI, App Service and Container Registry Resource from Resource Group
103-
id: get_openai_resource
104-
run: |
105-
106100

107-
set -e
108101
echo "Fetching OpenAI resource from resource group ${{ env.RESOURCE_GROUP_NAME }}..."
109102

110103
# Run the az resource list command to get the OpenAI resource name
@@ -199,8 +192,7 @@ jobs:
199192
IFS=',' read -r -a resources_to_check <<< "$stripped_keyvaults"
200193
201194
# Append new resources to the array
202-
resources_to_check+=("${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}")
203-
resources_to_check+=("${{ env.OPENAI_RESOURCE_NAME }}")
195+
resources_to_check+=("${{ env.LOG_ANALYTICS_WORKSPACE_NAME }}" "${{ env.OPENAI_RESOURCE_NAME }}")
204196
205197
echo "List of resources to check: ${resources_to_check[@]}"
206198
@@ -291,3 +283,4 @@ jobs:
291283
echo "KeyVault '$keyvault_name' is not soft-deleted. No action taken."
292284
fi
293285
done
286+
echo "Resource purging completed successfully"

0 commit comments

Comments
 (0)