Skip to content

Commit a6e0b38

Browse files
Merge pull request #549 from microsoft/dev
chore: dev to main merge
2 parents a2f83bd + 75b3770 commit a6e0b38

File tree

138 files changed

+16972
-1370
lines changed

Some content is hidden

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

138 files changed

+16972
-1370
lines changed

.github/workflows/codeql.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
2+
# For most projects, this workflow file will not need changing; you simply need
3+
# to commit it to your repository.
4+
#
5+
# You may wish to alter this file to override the set of languages analyzed,
6+
# or to provide custom queries or build logic.
7+
#
8+
# ******** NOTE ********
9+
# We have attempted to detect the languages in your repository. Please check
10+
# the `language` matrix defined below to confirm you have the correct set of
11+
# supported CodeQL languages.
12+
#
13+
name: "CodeQL Advanced"
14+
15+
on:
16+
push:
17+
branches: [ "main", "dev", "demo"]
18+
paths:
19+
- 'src/**/*.py'
20+
- 'src/**/*.js'
21+
- 'src/**/*.ts'
22+
- 'src/**/*.tsx'
23+
- 'tests/**/*.py'
24+
- '.github/workflows/codeql.yml'
25+
pull_request:
26+
branches: [ "main", "dev", "demo" ]
27+
paths:
28+
- 'src/**/*.py'
29+
- 'src/**/*.js'
30+
- 'src/**/*.ts'
31+
- 'src/**/*.tsx'
32+
- 'tests/**/*.py'
33+
- '.github/workflows/codeql.yml'
34+
schedule:
35+
- cron: '44 20 * * 2'
36+
37+
jobs:
38+
analyze:
39+
name: Analyze (${{ matrix.language }})
40+
# Runner size impacts CodeQL analysis time. To learn more, please see:
41+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
42+
# - https://gh.io/supported-runners-and-hardware-resources
43+
# - https://gh.io/using-larger-runners (GitHub.com only)
44+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
45+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
46+
permissions:
47+
# required for all workflows
48+
security-events: write
49+
50+
# required to fetch internal or private CodeQL packs
51+
packages: read
52+
53+
# only required for workflows in private repositories
54+
actions: read
55+
contents: read
56+
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
include:
61+
- language: javascript-typescript
62+
build-mode: none
63+
- language: python
64+
build-mode: none
65+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
66+
# Use `c-cpp` to analyze code written in C, C++ or both
67+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
68+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
69+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
70+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
71+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
72+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
73+
steps:
74+
- name: Checkout repository
75+
uses: actions/checkout@v4
76+
77+
# Initializes the CodeQL tools for scanning.
78+
- name: Initialize CodeQL
79+
uses: github/codeql-action/init@v4
80+
with:
81+
languages: ${{ matrix.language }}
82+
build-mode: ${{ matrix.build-mode }}
83+
# If you wish to specify custom queries, you can do so here or in a config file.
84+
# By default, queries listed here will override any specified in a config file.
85+
# Prefix the list here with "+" to use these queries and those in the config file.
86+
87+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
88+
# queries: security-extended,security-and-quality
89+
90+
# If the analyze step fails for one of the languages you are analyzing with
91+
# "We were unable to automatically build your code", modify the matrix above
92+
# to set the build mode to "manual" for that language. Then modify this step
93+
# to build your code.
94+
# ℹ️ Command-line programs to run using the OS shell.
95+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
96+
- if: matrix.build-mode == 'manual'
97+
shell: bash
98+
run: |
99+
echo 'If you are using a "manual" build mode for one or more of the' \
100+
'languages you are analyzing, replace this with the commands to build' \
101+
'your code, for example:'
102+
echo ' make bootstrap'
103+
echo ' make release'
104+
exit 1
105+
106+
- name: Perform CodeQL Analysis
107+
uses: github/codeql-action/analyze@v4
108+
with:
109+
category: "/language:${{matrix.language}}"

.github/workflows/deploy-orchestrator.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ on:
6464

6565
env:
6666
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
67-
permissions:
68-
contents: read
69-
actions: read
67+
7068
jobs:
7169
docker-build:
7270
uses: ./.github/workflows/job-docker-build.yml
Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy-Test-Cleanup (v2) Linux
1+
name: Deploy-Test-Cleanup (v2)
22
on:
33
push:
44
branches:
@@ -19,9 +19,17 @@ on:
1919
- 'src/ContentProcessorWeb/config-overrides.js'
2020
- 'src/ContentProcessorWeb/nginx-custom.conf'
2121
- 'src/ContentProcessorWeb/env.sh'
22-
- '.github/workflows/deploy-linux.yml'
22+
- '.github/workflows/deploy-v2.yml'
2323
workflow_dispatch:
2424
inputs:
25+
runner_os:
26+
description: 'Deployment Environment'
27+
required: false
28+
type: choice
29+
options:
30+
- 'codespace'
31+
- 'Local'
32+
default: 'codespace'
2533
azure_location:
2634
description: 'Azure Location For Deployment'
2735
required: false
@@ -95,11 +103,13 @@ on:
95103
permissions:
96104
contents: read
97105
actions: read
106+
id-token: write
98107
jobs:
99108
validate-inputs:
100109
runs-on: ubuntu-latest
101110
outputs:
102111
validation_passed: ${{ steps.validate.outputs.passed }}
112+
runner_os: ${{ steps.validate.outputs.runner_os }}
103113
azure_location: ${{ steps.validate.outputs.azure_location }}
104114
resource_group_name: ${{ steps.validate.outputs.resource_group_name }}
105115
waf_enabled: ${{ steps.validate.outputs.waf_enabled }}
@@ -125,9 +135,24 @@ jobs:
125135
INPUT_AZURE_ENV_EXISTING_LOG_ANALYTICS_WORKSPACE_RID: ${{ github.event.inputs.AZURE_ENV_EXISTING_LOG_ANALYTICS_WORKSPACE_RID }}
126136
INPUT_AZURE_EXISTING_AI_PROJECT_RESOURCE_ID: ${{ github.event.inputs.AZURE_EXISTING_AI_PROJECT_RESOURCE_ID }}
127137
INPUT_EXISTING_WEBAPP_URL: ${{ github.event.inputs.existing_webapp_url }}
138+
INPUT_RUNNER_OS: ${{ github.event.inputs.runner_os }}
128139
run: |
129140
echo "🔍 Validating workflow input parameters..."
130141
VALIDATION_FAILED=false
142+
143+
# Resolve runner_os from Deployment Environment selection
144+
DEPLOY_ENV="${INPUT_RUNNER_OS:-codespace}"
145+
if [[ "$DEPLOY_ENV" == "codespace" ]]; then
146+
RUNNER_OS="ubuntu-latest"
147+
echo "✅ Deployment Environment: 'codespace' → runner: ubuntu-latest"
148+
elif [[ "$DEPLOY_ENV" == "Local" ]]; then
149+
RUNNER_OS="windows-latest"
150+
echo "✅ Deployment Environment: 'Local' → runner: windows-latest"
151+
else
152+
echo "❌ ERROR: Deployment Environment must be 'codespace' or 'Local', got: '$DEPLOY_ENV'"
153+
VALIDATION_FAILED=true
154+
RUNNER_OS="ubuntu-latest"
155+
fi
131156
132157
# Validate azure_location (Azure region format)
133158
LOCATION="${INPUT_AZURE_LOCATION:-australiaeast}"
@@ -251,6 +276,7 @@ jobs:
251276
252277
# Output validated values
253278
echo "passed=true" >> $GITHUB_OUTPUT
279+
echo "runner_os=$RUNNER_OS" >> $GITHUB_OUTPUT
254280
echo "azure_location=$LOCATION" >> $GITHUB_OUTPUT
255281
echo "resource_group_name=$INPUT_RESOURCE_GROUP_NAME" >> $GITHUB_OUTPUT
256282
echo "waf_enabled=$WAF_ENABLED" >> $GITHUB_OUTPUT
@@ -267,7 +293,7 @@ jobs:
267293
if: needs.validate-inputs.outputs.validation_passed == 'true'
268294
uses: ./.github/workflows/deploy-orchestrator.yml
269295
with:
270-
runner_os: ubuntu-latest
296+
runner_os: ${{ needs.validate-inputs.outputs.runner_os || 'ubuntu-latest' }}
271297
azure_location: ${{ needs.validate-inputs.outputs.azure_location || 'australiaeast' }}
272298
resource_group_name: ${{ needs.validate-inputs.outputs.resource_group_name || '' }}
273299
waf_enabled: ${{ needs.validate-inputs.outputs.waf_enabled == 'true' }}

.github/workflows/deploy-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ on:
7878
permissions:
7979
contents: read
8080
actions: read
81+
id-token: write
8182
jobs:
8283
validate-inputs:
8384
runs-on: ubuntu-latest

.github/workflows/deploy.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ on:
1717
permissions:
1818
contents: read
1919
actions: read
20+
id-token: write
2021
jobs:
2122
deploy:
2223
runs-on: ubuntu-latest
24+
environment: production
2325
outputs:
2426
RESOURCE_GROUP_NAME: ${{ steps.generate_rg_name.outputs.RESOURCE_GROUP_NAME }}
2527
CONTAINER_WEB_APPURL: ${{ steps.get_output.outputs.CONTAINER_WEB_APPURL }}
@@ -34,16 +36,15 @@ jobs:
3436
uses: actions/checkout@v5
3537

3638
- name: Login to Azure
37-
run: |
38-
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
39-
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
39+
uses: azure/login@v2
40+
with:
41+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
42+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
43+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
4044

4145
- name: Run Quota Check
4246
id: quota-check
4347
env:
44-
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
45-
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
46-
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
4748
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
4849
GPT_MIN_CAPACITY: "100"
4950
AZURE_REGIONS: ${{ vars.AZURE_REGIONS }}
@@ -268,6 +269,7 @@ jobs:
268269
if: always()
269270
needs: [deploy, e2e-test]
270271
runs-on: ubuntu-latest
272+
environment: production
271273
env:
272274
RESOURCE_GROUP_NAME: ${{ needs.deploy.outputs.RESOURCE_GROUP_NAME }}
273275
AI_SERVICES_NAME: ${{ needs.deploy.outputs.AI_SERVICES_NAME }}
@@ -276,9 +278,11 @@ jobs:
276278
ENVIRONMENT_NAME: ${{ needs.deploy.outputs.ENVIRONMENT_NAME }}
277279
steps:
278280
- name: Login to Azure
279-
run: |
280-
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
281-
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
281+
uses: azure/login@v2
282+
with:
283+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
284+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
285+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
282286

283287
- name: Delete Bicep Deployment
284288
if: always()

.github/workflows/job-cleanup-deployment.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ on:
4040
description: 'Docker Image Tag'
4141
required: true
4242
type: string
43-
permissions:
44-
contents: read
45-
actions: read
43+
4644
jobs:
4745
cleanup-deployment:
4846
runs-on: ${{ inputs.runner_os }}
47+
environment: production
4948
continue-on-error: true
5049
env:
5150
RESOURCE_GROUP_NAME: ${{ inputs.RESOURCE_GROUP_NAME }}
@@ -201,10 +200,11 @@ jobs:
201200
echo "✅ All input parameters validated successfully!"
202201
203202
- name: Login to Azure
204-
shell: bash
205-
run: |
206-
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
207-
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
203+
uses: azure/login@v2
204+
with:
205+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
206+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
207+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
208208

209209
- name: Delete Resource Group (Optimized Cleanup)
210210
id: delete_rg

.github/workflows/job-deploy-linux.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ on:
3838
CONTAINER_WEB_APPURL:
3939
description: "Container Web App URL"
4040
value: ${{ jobs.deploy-linux.outputs.CONTAINER_WEB_APPURL }}
41-
permissions:
42-
contents: read
43-
actions: read
41+
4442
jobs:
4543
deploy-linux:
4644
runs-on: ubuntu-latest
45+
environment: production
4746
env:
4847
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
4948
outputs:
@@ -200,13 +199,18 @@ jobs:
200199
- name: Install azd
201200
uses: Azure/setup-azd@v2
202201

202+
- name: Login to Azure
203+
uses: azure/login@v2
204+
with:
205+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
206+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
207+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
208+
203209
- name: Login to AZD
204210
id: login-azure
205211
shell: bash
206212
run: |
207-
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
208-
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
209-
azd auth login --client-id ${{ secrets.AZURE_CLIENT_ID }} --client-secret ${{ secrets.AZURE_CLIENT_SECRET }} --tenant-id ${{ secrets.AZURE_TENANT_ID }}
213+
azd auth login --client-id ${{ secrets.AZURE_CLIENT_ID }} --federated-credential-provider "github" --tenant-id ${{ secrets.AZURE_TENANT_ID }}
210214
211215
- name: Deploy using azd up and extract values (Linux)
212216
id: get_output_linux

.github/workflows/job-deploy-windows.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ on:
3838
CONTAINER_WEB_APPURL:
3939
description: "Container Web App URL"
4040
value: ${{ jobs.deploy-windows.outputs.CONTAINER_WEB_APPURL }}
41-
permissions:
42-
contents: read
43-
actions: read
41+
4442
jobs:
4543
deploy-windows:
4644
runs-on: windows-latest
45+
environment: production
4746
env:
4847
AZURE_DEV_COLLECT_TELEMETRY: ${{ vars.AZURE_DEV_COLLECT_TELEMETRY }}
4948
outputs:
@@ -200,13 +199,18 @@ jobs:
200199
- name: Setup Azure Developer CLI (Windows)
201200
uses: Azure/setup-azd@v2
202201

202+
- name: Login to Azure
203+
uses: azure/login@v2
204+
with:
205+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
206+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
207+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
208+
203209
- name: Login to AZD
204210
id: login-azure
205211
shell: bash
206212
run: |
207-
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
208-
az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
209-
azd auth login --client-id ${{ secrets.AZURE_CLIENT_ID }} --client-secret ${{ secrets.AZURE_CLIENT_SECRET }} --tenant-id ${{ secrets.AZURE_TENANT_ID }}
213+
azd auth login --client-id ${{ secrets.AZURE_CLIENT_ID }} --federated-credential-provider "github" --tenant-id ${{ secrets.AZURE_TENANT_ID }}
210214
211215
- name: Deploy using azd up and extract values (Windows)
212216
id: get_output_windows

0 commit comments

Comments
 (0)