Skip to content

Commit f78b5af

Browse files
Merge remote-tracking branch 'origin/dev' into feature/avm-waf-aligned
2 parents 48e8a62 + 146e075 commit f78b5af

45 files changed

Lines changed: 2167 additions & 135 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/devcontainer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,26 @@
33
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
44
"forwardPorts": [50505],
55
"features": {
6-
"ghcr.io/azure/azure-dev/azd:latest": {}
6+
"ghcr.io/azure/azure-dev/azd:latest": {},
7+
"ghcr.io/devcontainers/features/azure-cli:1": {
8+
"installBicep": true,
9+
"version": "latest",
10+
"bicepVersion": "latest"
11+
}
712
},
813
"customizations": {
914
"vscode": {
1015
"extensions": [
1116
"ms-azuretools.azure-dev",
17+
"ms-azuretools.vscode-azcli",
1218
"ms-azuretools.vscode-bicep",
1319
"ms-python.python",
1420
"ms-toolsai.jupyter",
1521
"GitHub.vscode-github-actions"
1622
]
1723
}
1824
},
25+
"postCreateCommand": "sudo chmod +x ./scripts/quota_check_params.sh",
1926
"postStartCommand": "git pull origin main && python3 -m pip install -r ./src/frontend/requirements.txt && python3 -m pip install -r ./src/backend/requirements.txt",
2027
"remoteUser": "vscode",
2128
"hostRequirements": {

.github/dependabot.yml

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,56 @@
11
version: 2
22
updates:
3-
# GitHub Actions dependencies
4-
- package-ecosystem: "github-actions"
5-
directory: "/"
6-
schedule:
7-
interval: "monthly"
8-
commit-message:
9-
prefix: "build"
10-
target-branch: "dependabotchanges"
11-
open-pull-requests-limit: 100
3+
# GitHub Actions dependencies (grouped)
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"
8+
commit-message:
9+
prefix: "build"
10+
target-branch: "dependabotchanges"
11+
open-pull-requests-limit: 10
12+
groups:
13+
all-actions:
14+
patterns:
15+
- "*"
1216

13-
- package-ecosystem: "pip"
14-
directory: "/src/backend"
15-
schedule:
16-
interval: "monthly"
17-
commit-message:
18-
prefix: "build"
19-
target-branch: "dependabotchanges"
20-
open-pull-requests-limit: 100
17+
# Python dependencies (grouped)
18+
- package-ecosystem: "pip"
19+
directory: "/src/backend"
20+
schedule:
21+
interval: "monthly"
22+
commit-message:
23+
prefix: "build"
24+
target-branch: "dependabotchanges"
25+
open-pull-requests-limit: 10
26+
groups:
27+
all-backend-deps:
28+
patterns:
29+
- "*"
2130

22-
- package-ecosystem: "pip"
23-
directory: "/src/frontend"
24-
schedule:
25-
interval: "monthly"
26-
commit-message:
27-
prefix: "build"
28-
target-branch: "dependabotchanges"
29-
open-pull-requests-limit: 100
31+
- package-ecosystem: "pip"
32+
directory: "/src/frontend"
33+
schedule:
34+
interval: "monthly"
35+
commit-message:
36+
prefix: "build"
37+
target-branch: "dependabotchanges"
38+
open-pull-requests-limit: 10
39+
groups:
40+
all-backend-deps:
41+
patterns:
42+
- "*"
3043

31-
- package-ecosystem: "npm"
32-
directory: "/src/frontend"
33-
schedule:
34-
interval: "monthly"
35-
commit-message:
36-
prefix: "build"
37-
target-branch: "dependabotchanges"
38-
open-pull-requests-limit: 100
44+
# npm dependencies (grouped)
45+
- package-ecosystem: "npm"
46+
directory: "/src/frontend"
47+
schedule:
48+
interval: "monthly"
49+
commit-message:
50+
prefix: "build"
51+
target-branch: "dependabotchanges"
52+
open-pull-requests-limit: 10
53+
groups:
54+
all-frontend-deps:
55+
patterns:
56+
- "*"

.github/workflows/azure-dev-validation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ permissions:
1111
jobs:
1212
template_validation_job:
1313
runs-on: ubuntu-latest
14-
environment: dev
14+
environment: production
1515
name: Template validation
1616
steps:
1717
# Step 1: Checkout the code from your repository
@@ -31,4 +31,4 @@ jobs:
3131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3232
# Step 3: Print the result of the validation
3333
- name: Print result
34-
run: cat ${{ steps.validation.outputs.resultFile }}
34+
run: cat ${{ steps.validation.outputs.resultFile }}

.github/workflows/build-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
type: boolean
2424
secrets:
2525
DOCKER_PASSWORD:
26-
required: true
26+
required: false
2727

2828
jobs:
2929
docker-build:

.github/workflows/deploy.yml

Lines changed: 89 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
1-
name: Validate Deployment
1+
name: Deploy-Test-Cleanup Pipeline
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
schedule:
8-
- cron: '0 5,17 * * *' # Runs at 5:00 AM and 5:00 PM GMT
4+
workflow_run:
5+
workflows: ["Build Docker and Optional Push"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
- dev
11+
- demo
12+
schedule:
13+
- cron: '0 5,17 * * *' # Runs at 5:00 AM and 5:00 PM GMT
14+
workflow_dispatch:
15+
16+
env:
17+
GPT_MIN_CAPACITY: 200
18+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
919

1020
jobs:
1121
deploy:
1222
runs-on: ubuntu-latest
23+
outputs:
24+
RESOURCE_GROUP_NAME: ${{ steps.check_create_rg.outputs.RESOURCE_GROUP_NAME }}
25+
WEBAPP_URL: ${{ steps.get_output.outputs.WEBAPP_URL }}
1326
steps:
1427
- name: Checkout Code
1528
uses: actions/checkout@v3
@@ -35,7 +48,6 @@ jobs:
3548
UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
3649
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
3750
echo "Generated RESOURCE_GROUP_NAME: ${UNIQUE_RG_NAME}"
38-
3951
4052
- name: Check and Create Resource Group
4153
id: check_create_rg
@@ -49,8 +61,8 @@ jobs:
4961
else
5062
echo "Resource group already exists."
5163
fi
64+
echo "RESOURCE_GROUP_NAME=${{ env.RESOURCE_GROUP_NAME }}" >> $GITHUB_OUTPUT
5265
53-
5466
- name: Generate Unique Solution Prefix
5567
id: generate_solution_prefix
5668
run: |
@@ -62,16 +74,42 @@ jobs:
6274
echo "SOLUTION_PREFIX=${UNIQUE_SOLUTION_PREFIX}" >> $GITHUB_ENV
6375
echo "Generated SOLUTION_PREFIX: ${UNIQUE_SOLUTION_PREFIX}"
6476
65-
6677
- name: Deploy Bicep Template
6778
id: deploy
6879
run: |
6980
set -e
81+
# set image tag based on branch
82+
if [[ "${{ env.BRANCH_NAME }}" == "main" ]]; then
83+
IMAGE_TAG="latest"
84+
elif [[ "${{ env.BRANCH_NAME }}" == "dev" ]]; then
85+
IMAGE_TAG="dev"
86+
elif [[ "${{ env.BRANCH_NAME }}" == "demo" ]]; then
87+
IMAGE_TAG="demo"
88+
else
89+
IMAGE_TAG="latest"
90+
fi
91+
7092
az deployment group create \
93+
--name ${{ env.SOLUTION_PREFIX }}-deployment \
7194
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
7295
--template-file infra/main.bicep \
73-
--parameters AzureAiServiceLocation=northcentralus Prefix=${{ env.SOLUTION_PREFIX }}
74-
96+
--parameters \
97+
Prefix="${{ env.SOLUTION_PREFIX }}" \
98+
AzureAiServiceLocation="eastus" \
99+
capacity=${{ env.GPT_MIN_CAPACITY }} \
100+
imageVersion="${IMAGE_TAG}"\
101+
--debug
102+
103+
- name: Get Deployment Output and extract Values
104+
id: get_output
105+
run: |
106+
set -e
107+
echo "Fetching deployment output..."
108+
BICEP_OUTPUT=$(az deployment group show --name ${{ env.SOLUTION_PREFIX }}-deployment --resource-group ${{ env.RESOURCE_GROUP_NAME }} --query "properties.outputs" -o json)
109+
echo "Extracting deployment output..."
110+
WEBAPP_URL=$(echo $BICEP_OUTPUT | jq -r '.weB_APP_URL.value')
111+
echo "WEBAPP_URL=$WEBAPP_URL" >> $GITHUB_OUTPUT
112+
echo "Deployment output: $BICEP_OUTPUT"
75113
76114
- name: Send Notification on Failure
77115
if: failure()
@@ -91,8 +129,37 @@ jobs:
91129
-H "Content-Type: application/json" \
92130
-d "$EMAIL_BODY" || echo "Failed to send notification"
93131

132+
- name: Logout from Azure
133+
if: always()
134+
run: |
135+
az logout
136+
echo "Logged out from Azure."
137+
138+
e2e-test:
139+
needs: deploy
140+
uses: ./.github/workflows/test-automation.yml
141+
with:
142+
CODEMOD_WEB_URL: ${{ needs.deploy.outputs.WEBAPP_URL }}
143+
secrets: inherit
144+
145+
cleanup-deployment:
146+
if: always() && needs.deploy.outputs.RESOURCE_GROUP_NAME != ''
147+
needs: [deploy, e2e-test]
148+
runs-on: ubuntu-latest
149+
env:
150+
RESOURCE_GROUP_NAME: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
151+
steps:
152+
- name: Setup Azure CLI
153+
run: |
154+
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
155+
az --version # Verify installation
156+
157+
- name: Login to Azure
158+
run: |
159+
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
94160
95161
- name: Get Log Analytics Workspace and OpenAI from Resource Group
162+
if: always()
96163
id: get_azure_resources
97164
run: |
98165
@@ -123,8 +190,8 @@ jobs:
123190
echo "OpenAI resource name: ${openai_resource_name}"
124191
fi
125192

126-
127193
- name: List KeyVaults and Store in Array
194+
if: always()
128195
id: list_keyvaults
129196
run: |
130197
@@ -158,6 +225,7 @@ jobs:
158225
fi
159226
160227
- name: Purge log analytics workspace
228+
if: always()
161229
id: log_analytics_workspace
162230
run: |
163231
@@ -172,9 +240,8 @@ jobs:
172240
173241
echo "Log analytics workspace resource purging completed successfully"
174242
175-
176243
- name: Delete Bicep Deployment
177-
if: success()
244+
if: always()
178245
run: |
179246
set -e
180247
echo "Checking if resource group exists..."
@@ -190,8 +257,8 @@ jobs:
190257
echo "Resource group does not exists."
191258
fi
192259
193-
194260
- name: Wait for resource deletion to complete
261+
if: always()
195262
run: |
196263
197264
# List of keyvaults
@@ -249,10 +316,9 @@ jobs:
249316
break
250317
fi
251318
done
252-
253319
254320
- name: Purging the Resources
255-
if: success()
321+
if: always()
256322
run: |
257323
258324
set -e
@@ -296,3 +362,9 @@ jobs:
296362
fi
297363
done
298364
echo "Resource purging completed successfully"
365+
366+
- name: Logout from Azure
367+
if: always()
368+
run: |
369+
az logout
370+
echo "Logged out from Azure."

0 commit comments

Comments
 (0)