Skip to content

Commit c05cdc5

Browse files
Merge pull request #600 from microsoft/dev
fix: merging dev to main
2 parents 6763250 + f231e45 commit c05cdc5

21 files changed

Lines changed: 4076 additions & 2580 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: AZD Template Validation
2+
on:
3+
schedule:
4+
- cron: '30 1 * * 4' # Every Thursday at 7:00 AM IST (1:30 AM UTC)
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
id-token: write
10+
pull-requests: write
11+
12+
jobs:
13+
template_validation:
14+
runs-on: ubuntu-latest
15+
name: azd template validation
16+
environment: production
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set timestamp
21+
run: echo "HHMM=$(date -u +'%H%M')" >> $GITHUB_ENV
22+
23+
- uses: microsoft/template-validation-action@v0.4.3
24+
with:
25+
validateAzd: ${{ vars.TEMPLATE_VALIDATE_AZD }}
26+
validateTests: ${{ vars.TEMPLATE_VALIDATE_TESTS }}
27+
useDevContainer: ${{ vars.TEMPLATE_USE_DEV_CONTAINER }}
28+
id: validation
29+
env:
30+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
31+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
32+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
33+
AZURE_ENV_NAME: azd-${{ vars.AZURE_ENV_NAME }}-${{ env.HHMM }}
34+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
35+
AZURE_ENV_OPENAI_LOCATION: ${{ vars.AZURE_LOCATION }}
36+
AZURE_ENV_MODEL_CAPACITY: 10 # keep low to avoid potential quota issues
37+
AZURE_ENV_EMBEDDING_MODEL_CAPACITY: 10 # keep low to avoid potential quota issues
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: print result
41+
run: cat ${{ steps.validation.outputs.resultFile }}

.github/workflows/azure-dev.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Azure Dev Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
id-token: write
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
environment: production
14+
env:
15+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
16+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
17+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
18+
AZURE_ENV_NAME: ${{ vars.AZURE_ENV_NAME }}${{ github.run_number }}
19+
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
20+
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v4
24+
25+
- name: Set timestamp and env name
26+
run: |
27+
HHMM=$(date -u +'%H%M')
28+
echo "AZURE_ENV_NAME=azd-${{ vars.AZURE_ENV_NAME }}-${HHMM}" >> $GITHUB_ENV
29+
30+
- name: Install azd
31+
uses: Azure/setup-azd@v2
32+
33+
- name: Login to Azure
34+
uses: azure/login@v2
35+
with:
36+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
37+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
38+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
39+
40+
- name: Login to AZD
41+
shell: bash
42+
run: |
43+
azd auth login \
44+
--client-id "$AZURE_CLIENT_ID" \
45+
--federated-credential-provider "github" \
46+
--tenant-id "$AZURE_TENANT_ID"
47+
48+
- name: Provision and Deploy
49+
shell: bash
50+
run: |
51+
if ! azd env select "$AZURE_ENV_NAME"; then
52+
azd env new "$AZURE_ENV_NAME" --subscription "$AZURE_SUBSCRIPTION_ID" --location "$AZURE_LOCATION" --no-prompt
53+
fi
54+
azd config set defaults.subscription "$AZURE_SUBSCRIPTION_ID"
55+
azd env set AZURE_ENV_OPENAI_LOCATION="$AZURE_LOCATION"
56+
azd up --no-prompt

.github/workflows/deploy-v2.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@ on:
55
- main # Adjust this to the branch you want to trigger the deployment on
66
- dev
77
- demo
8+
paths:
9+
- 'infra/**'
10+
- 'App/**'
11+
- 'Deployment/**'
12+
- 'azure.yaml'
13+
- '.github/workflows/deploy-v2.yml'
14+
- '.github/workflows/deploy-orchestrator.yml'
15+
- '.github/workflows/job-deploy.yml'
16+
- '.github/workflows/job-deploy-linux.yml'
17+
- '.github/workflows/job-cleanup-deployment.yml'
18+
- '.github/workflows/job-send-notification.yml'
19+
- '.github/workflows/test-automation-v2.yml'
20+
- 'tests/**'
821
schedule:
922
- cron: "0 10,22 * * *" # Runs at 10:00 AM and 10:00 PM UTC
1023

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Validate Bicep Parameters
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
schedule:
8+
- cron: '30 6 * * 3' # Wednesday 12:00 PM IST (6:30 AM UTC)
9+
pull_request:
10+
branches:
11+
- main
12+
- dev
13+
paths:
14+
- 'infra/**/*.bicep'
15+
- 'infra/**/*.parameters.json'
16+
- 'Deployment/validate_bicep_params.py'
17+
workflow_dispatch:
18+
19+
env:
20+
accelerator_name: "DKM"
21+
22+
jobs:
23+
validate:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout Code
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: '3.11'
33+
34+
- name: Validate infra/ parameters
35+
id: validate_infra
36+
continue-on-error: true
37+
run: |
38+
set +e
39+
python Deployment/validate_bicep_params.py --dir infra --strict --no-color --json-output infra_results.json 2>&1 | tee infra_output.txt
40+
EXIT_CODE=${PIPESTATUS[0]}
41+
set -e
42+
echo "## Infra Param Validation" >> "$GITHUB_STEP_SUMMARY"
43+
echo '```' >> "$GITHUB_STEP_SUMMARY"
44+
cat infra_output.txt >> "$GITHUB_STEP_SUMMARY"
45+
echo '```' >> "$GITHUB_STEP_SUMMARY"
46+
exit $EXIT_CODE
47+
48+
- name: Set overall result
49+
id: result
50+
run: |
51+
if [[ "${{ steps.validate_infra.outcome }}" == "failure" ]]; then
52+
echo "status=failure" >> "$GITHUB_OUTPUT"
53+
else
54+
echo "status=success" >> "$GITHUB_OUTPUT"
55+
fi
56+
57+
- name: Upload validation results
58+
if: always()
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: bicep-validation-results
62+
path: |
63+
infra_results.json
64+
retention-days: 30
65+
66+
- name: Send schedule notification on failure
67+
if: github.event_name == 'schedule' && steps.result.outputs.status == 'failure'
68+
env:
69+
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
70+
GITHUB_REPOSITORY: ${{ github.repository }}
71+
GITHUB_RUN_ID: ${{ github.run_id }}
72+
ACCELERATOR_NAME: ${{ env.accelerator_name }}
73+
run: |
74+
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
75+
INFRA_OUTPUT=$(sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' infra_output.txt)
76+
77+
jq -n \
78+
--arg name "${ACCELERATOR_NAME}" \
79+
--arg infra "$INFRA_OUTPUT" \
80+
--arg url "$RUN_URL" \
81+
'{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>")}' \
82+
| curl -X POST "${LOGICAPP_URL}" \
83+
-H "Content-Type: application/json" \
84+
-d @- || echo "Failed to send notification"
85+
86+
- name: Send schedule notification on success
87+
if: github.event_name == 'schedule' && steps.result.outputs.status == 'success'
88+
env:
89+
LOGICAPP_URL: ${{ secrets.EMAILNOTIFICATION_LOGICAPP_URL_TA }}
90+
GITHUB_REPOSITORY: ${{ github.repository }}
91+
GITHUB_RUN_ID: ${{ github.run_id }}
92+
ACCELERATOR_NAME: ${{ env.accelerator_name }}
93+
run: |
94+
RUN_URL="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
95+
INFRA_OUTPUT=$(sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g' infra_output.txt)
96+
97+
jq -n \
98+
--arg name "${ACCELERATOR_NAME}" \
99+
--arg infra "$INFRA_OUTPUT" \
100+
--arg url "$RUN_URL" \
101+
'{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>")}' \
102+
| curl -X POST "${LOGICAPP_URL}" \
103+
-H "Content-Type: application/json" \
104+
-d @- || echo "Failed to send notification"
105+
106+
- name: Fail if errors found
107+
if: steps.result.outputs.status == 'failure'
108+
run: exit 1

0 commit comments

Comments
 (0)