Skip to content

Commit 8ba1598

Browse files
Merge pull request #360 from microsoft/main
feat: Merging from main to demo
2 parents fd5dda9 + aed17d1 commit 8ba1598

File tree

243 files changed

+77533
-3530
lines changed

Some content is hidden

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

243 files changed

+77533
-3530
lines changed

.azdo/pipelines/azure-dev.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Run when commits are pushed to mainline branch (main or master)
2+
# Set this to the mainline branch you are using
3+
trigger:
4+
- main
5+
- master
6+
7+
# Azure Pipelines workflow to deploy to Azure using azd
8+
# To configure required secrets and service connection for connecting to Azure, simply run `azd pipeline config --provider azdo`
9+
# Task "Install azd" needs to install setup-azd extension for azdo - https://marketplace.visualstudio.com/items?itemName=ms-azuretools.azd
10+
# See below for alternative task to install azd if you can't install above task in your organization
11+
12+
pool:
13+
vmImage: ubuntu-latest
14+
15+
steps:
16+
- task: setup-azd@0
17+
displayName: Install azd
18+
19+
# If you can't install above task in your organization, you can comment it and uncomment below task to install azd
20+
# - task: Bash@3
21+
# displayName: Install azd
22+
# inputs:
23+
# targetType: 'inline'
24+
# script: |
25+
# curl -fsSL https://aka.ms/install-azd.sh | bash
26+
27+
# azd delegate auth to az to use service connection with AzureCLI@2
28+
- pwsh: |
29+
azd config set auth.useAzCliAuth "true"
30+
displayName: Configure AZD to Use AZ CLI Authentication.
31+
32+
- task: AzureCLI@2
33+
displayName: Provision Infrastructure
34+
inputs:
35+
azureSubscription: azconnection
36+
scriptType: bash
37+
scriptLocation: inlineScript
38+
inlineScript: |
39+
azd provision --no-prompt
40+
env:
41+
42+
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
43+
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
44+
AZURE_LOCATION: $(AZURE_LOCATION)
45+
# Project specific environment variables
46+
# AZURE_RESOURCE_GROUP: $(AZURE_RESOURCE_GROUP)
47+
# AZURE_AIHUB_NAME: $(AZURE_AIHUB_NAME)
48+
# AZURE_AIPROJECT_NAME: $(AZURE_AIPROJECT_NAME)
49+
# AZURE_AISERVICES_NAME: $(AZURE_AISERVICES_NAME)
50+
# AZURE_SEARCH_SERVICE_NAME: $(AZURE_SEARCH_SERVICE_NAME)
51+
# AZURE_APPLICATION_INSIGHTS_NAME: $(AZURE_APPLICATION_INSIGHTS_NAME)
52+
# AZURE_CONTAINER_REGISTRY_NAME: $(AZURE_CONTAINER_REGISTRY_NAME)
53+
# AZURE_KEYVAULT_NAME: $(AZURE_KEYVAULT_NAME)
54+
# AZURE_STORAGE_ACCOUNT_NAME: $(AZURE_STORAGE_ACCOUNT_NAME)
55+
# AZURE_LOG_ANALYTICS_WORKSPACE_NAME: $(AZURE_LOG_ANALYTICS_WORKSPACE_NAME)
56+
# USE_CONTAINER_REGISTRY: $(USE_CONTAINER_REGISTRY)
57+
# USE_APPLICATION_INSIGHTS: $(USE_APPLICATION_INSIGHTS)
58+
# USE_SEARCH_SERVICE: $(USE_SEARCH_SERVICE)
59+
# AZURE_AI_CHAT_DEPLOYMENT_NAME: $(AZURE_AI_CHAT_DEPLOYMENT_NAME)
60+
# AZURE_AI_CHAT_DEPLOYMENT_SKU: $(AZURE_AI_CHAT_DEPLOYMENT_SKU)
61+
# AZURE_AI_CHAT_DEPLOYMENT_CAPACITY: $(AZURE_AI_CHAT_DEPLOYMENT_CAPACITY)
62+
# AZURE_AI_CHAT_MODEL_FORMAT: $(AZURE_AI_CHAT_MODEL_FORMAT)
63+
# AZURE_AI_CHAT_MODEL_NAME: $(AZURE_AI_CHAT_MODEL)
64+
# AZURE_AI_CHAT_MODEL_VERSION: $(AZURE_AI_CHAT_MODEL_VERSION)
65+
# AZURE_AI_EMBED_DEPLOYMENT_NAME: $(AZURE_AI_EMBED_DEPLOYMENT_NAME)
66+
# AZURE_AI_EMBED_DEPLOYMENT_SKU: $(AZURE_AI_EMBED_DEPLOYMENT_SKU)
67+
# AZURE_AI_EMBED_DEPLOYMENT_CAPACITY: $(AZURE_AI_EMBED_DEPLOYMENT_CAPACITY)
68+
# AZURE_AI_EMBED_MODEL_FORMAT: $(AZURE_AI_EMBED_MODEL_FORMAT)
69+
# AZURE_AI_EMBED_MODEL_NAME: $(AZURE_AI_EMBED_MODEL_NAME)
70+
# AZURE_AI_EMBED_MODEL_VERSION: $(AZURE_AI_EMBED_MODEL_VERSION)
71+
# AZURE_EXISTING_AIPROJECT_CONNECTION_STRING: $(AZURE_EXISTING_AIPROJECT_CONNECTION_STRING)
72+
- task: AzureCLI@2
73+
displayName: Deploy Application
74+
inputs:
75+
azureSubscription: azconnection
76+
scriptType: bash
77+
scriptLocation: inlineScript
78+
inlineScript: |
79+
azd deploy --no-prompt
80+
env:
81+
AZURE_SUBSCRIPTION_ID: $(AZURE_SUBSCRIPTION_ID)
82+
AZURE_ENV_NAME: $(AZURE_ENV_NAME)
83+
AZURE_LOCATION: $(AZURE_LOCATION)

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[run]
2+
omit =
3+
*/test_*.py

.devcontainer/devcontainer.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "azd-template",
3+
"image": "mcr.microsoft.com/devcontainers/python:3.11-bullseye",
4+
"forwardPorts": [50505],
5+
"features": {
6+
"ghcr.io/azure/azure-dev/azd:latest": {}
7+
},
8+
"customizations": {
9+
"vscode": {
10+
"extensions": [
11+
"ms-azuretools.azure-dev",
12+
"ms-azuretools.vscode-bicep",
13+
"ms-python.python",
14+
"ms-toolsai.jupyter",
15+
"GitHub.vscode-github-actions"
16+
]
17+
}
18+
},
19+
"postStartCommand": "git pull origin main && python3 -m pip install -r infra/scripts/index_scripts/requirements.txt && curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash && chmod +x ./infra/scripts/quota_check_params.sh",
20+
"remoteUser": "vscode",
21+
"hostRequirements": {
22+
"memory": "4gb"
23+
}
24+
}

.flake8

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E501
4+
exclude = .venv, frontend
5+
ignore = E203, W503, G004, G200

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Each line is a file pattern followed by one or more owners.
33

44
# These owners will be the default owners for everything in the repo.
5-
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @aniaroramsft @brittneek
5+
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft @aniaroramsft @brittneek @Vinay-Microsoft

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ Verify that the following are valid
3434
* ...
3535

3636
## Other Information
37+
3738
<!-- Add any other helpful information that may be needed here. -->
39+

.github/dependabot.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
version: 2
2+
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
12+
13+
- package-ecosystem: "pip"
14+
directory: "/App"
15+
schedule:
16+
interval: "monthly"
17+
commit-message:
18+
prefix: "build"
19+
target-branch: "dependabotchanges"
20+
open-pull-requests-limit: 100
21+
22+
- package-ecosystem: "npm"
23+
directory: "/App/frontend"
24+
schedule:
25+
interval: "monthly"
26+
commit-message:
27+
prefix: "build"
28+
target-branch: "dependabotchanges"
29+
open-pull-requests-limit: 100
30+
registries:
31+
- npm_public_registry # Only use public npm registry
32+
33+
registries:
34+
npm_public_registry:
35+
type: "npm-registry"
36+
url: "https://registry.npmjs.org/"
37+
token: ${{ secrets.TOKEN }}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Azure Template Validation
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
contents: read
7+
id-token: write
8+
pull-requests: write
9+
10+
jobs:
11+
template_validation_job:
12+
runs-on: ubuntu-latest
13+
name: Template validation
14+
15+
steps:
16+
# Step 1: Checkout the code from your repository
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
# Step 2: Validate the Azure template using microsoft/template-validation-action
21+
- name: Validate Azure Template
22+
uses: microsoft/[email protected]
23+
id: validation
24+
env:
25+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
26+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
27+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
28+
AZURE_ENV_NAME: ${{ secrets.AZURE_ENV_NAME }}
29+
AZURE_LOCATION: ${{ secrets.AZURE_LOCATION }}
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
32+
# Step 3: Print the result of the validation
33+
- name: Print result
34+
run: cat ${{ steps.validation.outputs.resultFile }}
Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
name: CI-Validate Deployment
1+
name: Validate Deployment - CKM V2
22
on:
33
push:
44
branches:
5-
- main
6-
schedule:
7-
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
5+
- ckm-v2
6+
87

98
jobs:
109
deploy:
@@ -13,6 +12,49 @@ jobs:
1312
- name: Checkout Code
1413
uses: actions/checkout@v3
1514

15+
- name: Run Quota Check
16+
id: quota-check
17+
run: |
18+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
19+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
20+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
21+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
22+
export GPT_MIN_CAPACITY="30"
23+
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
24+
25+
chmod +x infra/scripts/checkquota_ckmv2.sh
26+
if ! infra/scripts/checkquota_ckmv2.sh; then
27+
# If quota check fails due to insufficient quota, set the flag
28+
if grep -q "No region with sufficient quota found" infra/scripts/checkquota_ckmv2.sh; then
29+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
30+
fi
31+
exit 1 # Fail the pipeline if any other failure occurs
32+
fi
33+
34+
- name: Send Notification on Quota Failure
35+
if: env.QUOTA_FAILED == 'true'
36+
run: |
37+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
38+
EMAIL_BODY=$(cat <<EOF
39+
{
40+
"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>"
41+
}
42+
EOF
43+
)
44+
45+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
46+
-H "Content-Type: application/json" \
47+
-d "$EMAIL_BODY" || echo "Failed to send notification"
48+
49+
- name: Fail Pipeline if Quota Check Fails
50+
if: env.QUOTA_FAILED == 'true'
51+
run: exit 1
52+
53+
- name: Set Deployment Region
54+
run: |
55+
echo "Selected Region: $VALID_REGION"
56+
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
57+
1658
- name: Setup Azure CLI
1759
run: |
1860
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
@@ -37,7 +79,7 @@ jobs:
3779
3880
- name: Create Resource Group
3981
run: |
40-
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location eastus
82+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location ${{ env.AZURE_LOCATION }}
4183
4284
- name: Generate Unique Solution Prefix
4385
id: generate_solution_prefix
@@ -56,8 +98,8 @@ jobs:
5698
set -e
5799
az deployment group create \
58100
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
59-
--template-file Deployment/bicep/main.bicep \
60-
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }} location=eastus
101+
--template-file infra/main.bicep \
102+
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }} location=${{ env.AZURE_LOCATION }}
61103
62104
- name: Delete Bicep Deployment
63105
if: success()
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Create Release"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
create-release:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.sha }}
21+
22+
- uses: codfish/semantic-release-action@v3
23+
id: semantic
24+
with:
25+
tag-format: 'v${version}'
26+
additional-packages: |
27+
['conventional-changelog-conventionalcommits@7']
28+
plugins: |
29+
[
30+
[
31+
"@semantic-release/commit-analyzer",
32+
{
33+
"preset": "conventionalcommits"
34+
}
35+
],
36+
[
37+
"@semantic-release/release-notes-generator",
38+
{
39+
"preset": "conventionalcommits",
40+
"presetConfig": {
41+
"types": [
42+
{ type: 'feat', section: 'Features', hidden: false },
43+
{ type: 'fix', section: 'Bug Fixes', hidden: false },
44+
{ type: 'perf', section: 'Performance Improvements', hidden: false },
45+
{ type: 'revert', section: 'Reverts', hidden: false },
46+
{ type: 'docs', section: 'Other Updates', hidden: false },
47+
{ type: 'style', section: 'Other Updates', hidden: false },
48+
{ type: 'chore', section: 'Other Updates', hidden: false },
49+
{ type: 'refactor', section: 'Other Updates', hidden: false },
50+
{ type: 'test', section: 'Other Updates', hidden: false },
51+
{ type: 'build', section: 'Other Updates', hidden: false },
52+
{ type: 'ci', section: 'Other Updates', hidden: false }
53+
]
54+
}
55+
}
56+
],
57+
'@semantic-release/github'
58+
]
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- run: echo ${{ steps.semantic.outputs.release-version }}
63+
64+
- run: echo "$OUTPUTS"
65+
env:
66+
OUTPUTS: ${{ toJson(steps.semantic.outputs) }}

0 commit comments

Comments
 (0)