Skip to content

Commit a9a8c70

Browse files
Merge branch 'main' into main
2 parents cb6dd23 + d0269a9 commit a9a8c70

File tree

126 files changed

+19038
-6329
lines changed

Some content is hidden

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

126 files changed

+19038
-6329
lines changed

.env.sample

+14-8
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ AZURE_SEARCH_DATASOURCE_NAME=
2222
# Azure OpenAI for generating the answer and computing the embedding of the documents
2323
AZURE_OPENAI_RESOURCE=
2424
AZURE_OPENAI_API_KEY=
25-
AZURE_OPENAI_MODEL_INFO="{\"model\":\"gpt-35-turbo-16k\",\"modelName\":\"gpt-35-turbo-16k\",\"modelVersion\":\"0613\"}"
26-
AZURE_OPENAI_EMBEDDING_MODEL_INFO="{\"model\":\"text-embedding-ada-002\",\"modelName\":\"text-embedding-ada-002\",\"modelVersion\":\"2\"}"
25+
AZURE_OPENAI_MODEL=gpt-4o
26+
AZURE_OPENAI_MODEL_NAME=gpt-4o
27+
AZURE_OPENAI_EMBEDDING_MODEL=text-embedding-ada-002
2728
AZURE_OPENAI_TEMPERATURE=0
2829
AZURE_OPENAI_TOP_P=1.0
2930
AZURE_OPENAI_MAX_TOKENS=1000
@@ -35,10 +36,12 @@ AZURE_OPENAI_STREAM=True
3536
AzureWebJobsStorage=
3637
BACKEND_URL=http://localhost:7071
3738
DOCUMENT_PROCESSING_QUEUE_NAME=
38-
# Azure Blob Storage for storing the original documents to be processed
39-
AZURE_BLOB_STORAGE_INFO="{\"containerName\":\"documents\",\"accountName\":\"\",\"accountKey\":\"\"}"
39+
AZURE_BLOB_ACCOUNT_NAME=
40+
AZURE_BLOB_ACCOUNT_KEY=
41+
AZURE_BLOB_CONTAINER_NAME=
4042
# Azure Form Recognizer for extracting the text from the documents
41-
AZURE_FORM_RECOGNIZER_INFO="{\"endpoint\":\"\",\"key\":\"\"}"
43+
AZURE_FORM_RECOGNIZER_ENDPOINT=
44+
AZURE_FORM_RECOGNIZER_KEY=
4245
# Azure AI Content Safety for filtering out the inappropriate questions or answers
4346
AZURE_CONTENT_SAFETY_ENDPOINT=
4447
AZURE_CONTENT_SAFETY_KEY=
@@ -60,8 +63,11 @@ AZURE_KEY_VAULT_ENDPOINT=
6063
# Chat conversation type to decide between custom or byod (bring your own data) conversation type
6164
CONVERSATION_FLOW=
6265
# Chat History CosmosDB Integration Settings
63-
AZURE_COSMOSDB_INFO="{\"accountName\":\"cosmos-abc123\",\"databaseName\":\"db_conversation_history\",\"containerName\":\"conversations\"}"
64-
AZURE_COSMOSDB_ACCOUNT_KEY=
66+
AZURE_COSMOSDB_ACCOUNT_NAME=
67+
AZURE_COSMOSDB_DATABASE_NAME=
68+
AZURE_COSMOSDB_CONVERSATIONS_CONTAINER_NAME=
6569
AZURE_COSMOSDB_ENABLE_FEEDBACK=
66-
AZURE_POSTGRESQL_INFO="{\"user\":\"\",\"dbname\":\"postgres\",\"host\":\"\"}"
70+
AZURE_POSTGRESQL_HOST_NAME=
71+
AZURE_POSTGRESQL_DATABASE_NAME=
72+
AZURE_POSTGRESQL_USER=
6773
DATABASE_TYPE="CosmosDB"

.github/dependabot.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ updates:
2424
langchain:
2525
patterns:
2626
- "langchain*"
27-
open-pull-requests-limit: 50
27+
open-pull-requests-limit: 100
2828
target-branch: "dependabotchanges"
2929
- package-ecosystem: "npm"
3030
directory: "/code/frontend"
@@ -34,7 +34,7 @@ updates:
3434

3535
commit-message:
3636
prefix: "build"
37-
open-pull-requests-limit: 50
37+
open-pull-requests-limit: 100
3838
target-branch: "dependabotchanges"
3939
- package-ecosystem: "npm"
4040
directory: "/tests/integration/ui"
@@ -44,5 +44,5 @@ updates:
4444

4545
commit-message:
4646
prefix: "build"
47-
open-pull-requests-limit: 50
47+
open-pull-requests-limit: 100
4848
target-branch: "dependabotchanges"

.github/workflows/bicep-audit.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Validate bicep templates
22
on:
33
push:
4-
branches:
4+
branches:
55
- main
66
paths:
77
- "**/*.bicep"
88
pull_request:
9-
branches:
9+
branches:
1010
- main
1111
paths:
1212
- "**/*.bicep"
+12-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
name: Build Docker Images
1+
name: Build Docker and Optional Push
22

33
on:
4-
workflow_run:
5-
workflows: [Tests]
6-
types: [completed]
4+
push:
75
branches:
86
- main
97
- dev
@@ -14,15 +12,15 @@ on:
1412
- dev
1513
- demo
1614
types:
17-
- opened
18-
- ready_for_review
19-
- reopened
20-
- synchronize
15+
- opened
16+
- ready_for_review
17+
- reopened
18+
- synchronize
2119
merge_group:
20+
workflow_dispatch:
2221

2322
jobs:
2423
docker-build:
25-
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
2624
strategy:
2725
matrix:
2826
include:
@@ -34,9 +32,11 @@ jobs:
3432
dockerfile: docker/Frontend.Dockerfile
3533
uses: ./.github/workflows/build-docker.yml
3634
with:
37-
registry: ${{ github.event.workflow_run.head_branch == 'main' && 'fruoccopublic.azurecr.io' || 'cwydcontainerreg.azurecr.io'}}
38-
username: ${{ github.event.workflow_run.head_branch == 'main' && 'fruoccopublic' || 'cwydcontainerreg'}}
35+
old_registry: ${{ github.ref_name == 'main' && 'fruoccopublic.azurecr.io' }}
36+
new_registry: 'cwydcontainerreg.azurecr.io'
37+
old_username: ${{ github.ref_name == 'main' && 'fruoccopublic' }}
38+
new_username: 'cwydcontainerreg'
3939
app_name: ${{ matrix.app_name }}
4040
dockerfile: ${{ matrix.dockerfile }}
41-
push: ${{ github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'dev' || github.event.workflow_run.head_branch == 'demo' }}
41+
push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo'|| github.ref_name == 'dependabotchanges' }}
4242
secrets: inherit

.github/workflows/build-docker.yml

+41-13
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ name: Reusable Docker build and push workflow
33
on:
44
workflow_call:
55
inputs:
6-
registry:
6+
old_registry:
77
required: true
88
type: string
9-
username:
9+
old_username:
10+
required: true
11+
type: string
12+
new_registry:
13+
required: true
14+
type: string
15+
new_username:
1016
required: true
1117
type: string
1218
app_name:
@@ -28,24 +34,33 @@ jobs:
2834
docker-build:
2935
runs-on: ubuntu-latest
3036
steps:
31-
3237
- name: Checkout
3338
uses: actions/checkout@v4
3439

35-
- name: Docker Login
40+
# Login for 'main' branch to both registries
41+
- name: Docker Login to fruoccopublic (Main)
3642
if: ${{ inputs.push == true && github.ref_name == 'main' }}
3743
uses: docker/login-action@v3
3844
with:
39-
registry: ${{ inputs.registry }}
40-
username: ${{ inputs.username }}
45+
registry: ${{ inputs.old_registry }}
46+
username: ${{ inputs.old_username }}
4147
password: ${{ secrets.DOCKER_PASSWORD }}
4248

43-
- name: Dev Docker Login
49+
- name: Docker Login to cwydcontainerreg (Main)
50+
if: ${{ inputs.push == true && github.ref_name == 'main' }}
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ${{ inputs.new_registry }}
54+
username: ${{ inputs.new_username }}
55+
password: ${{ secrets.DEV_DOCKER_PASSWORD }}
56+
57+
# Login for 'dev' and 'demo' branches to cwydcontainerreg only
58+
- name: Docker Login to cwydcontainerreg (Dev/Demo)
4459
if: ${{ inputs.push == true && (github.ref_name == 'dev' || github.ref_name == 'demo') }}
4560
uses: docker/login-action@v3
4661
with:
47-
registry: ${{ inputs.registry }}
48-
username: ${{ inputs.username }}
62+
registry: ${{ inputs.new_registry }}
63+
username: ${{ inputs.new_username }}
4964
password: ${{ secrets.DEV_DOCKER_PASSWORD }}
5065

5166
- name: Set up Docker Buildx
@@ -55,13 +70,26 @@ jobs:
5570
id: date
5671
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
5772

58-
- name: Build Docker Image and optionally push
73+
- name: Build Docker Image and optionally push (Old Registry)
74+
if: ${{ github.ref_name == 'main' }}
75+
uses: docker/build-push-action@v6
76+
with:
77+
context: .
78+
file: ${{ inputs.dockerfile }}
79+
push: ${{ inputs.push }}
80+
cache-from: type=registry,ref=${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.head_ref || github.ref_name }}
81+
tags: |
82+
${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.head_ref || 'default' }}
83+
${{ inputs.old_registry }}/${{ inputs.app_name }}:${{ steps.date.outputs.date }}_${{ github.run_number }}
84+
85+
- name: Build Docker Image and optionally push (New Registry)
86+
if: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo'|| github.ref_name == 'dependabotchanges' }}
5987
uses: docker/build-push-action@v6
6088
with:
6189
context: .
6290
file: ${{ inputs.dockerfile }}
6391
push: ${{ inputs.push }}
64-
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }}
92+
cache-from: type=registry,ref=${{ inputs.new_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo'|| github.ref_name == 'dependabotchanges' && 'dependabotchanges' || github.head_ref || github.ref_name }}
6593
tags: |
66-
${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || 'latest' }}
67-
${{ inputs.registry }}/${{ inputs.app_name}}:${{ steps.date.outputs.date }}_${{ github.run_number }}
94+
${{ inputs.new_registry }}/${{ inputs.app_name }}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo'|| github.ref_name == 'dependabotchanges' && 'dependabotchanges' || github.head_ref || 'default' }}
95+
${{ inputs.new_registry }}/${{ inputs.app_name }}:${{ steps.date.outputs.date }}_${{ github.run_number }}

.github/workflows/ci.yml

+51-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Validate Deployment
22

33
on:
44
push:
@@ -7,7 +7,7 @@ on:
77
- dev
88
- demo
99
schedule:
10-
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
10+
- cron: '0 8,20 * * *' # Runs at 8:00 AM and 8:00 PM GMT
1111

1212
permissions:
1313
contents: read
@@ -29,6 +29,53 @@ jobs:
2929
- name: Checkout code
3030
uses: actions/checkout@v4
3131

32+
# Run Quota Check Script
33+
- name: Run Quota Check
34+
id: quota-check
35+
run: |
36+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
37+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
38+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
39+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
40+
export GPT_MIN_CAPACITY="30"
41+
export TEXT_EMBEDDING_MIN_CAPACITY="30"
42+
export AZURE_REGIONS="${{ vars.AZURE_REGIONS }}"
43+
44+
chmod +x scripts/checkquota.sh
45+
if ! scripts/checkquota.sh; then
46+
# If quota check fails due to insufficient quota, set the flag
47+
if grep -q "No region with sufficient quota found" scripts/checkquota.sh; then
48+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
49+
fi
50+
exit 1 # Fail the pipeline if any other failure occurs
51+
fi
52+
53+
- name: Send Notification on Quota Failure
54+
if: env.QUOTA_FAILED == 'true'
55+
run: |
56+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
57+
EMAIL_BODY=$(cat <<EOF
58+
{
59+
"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>"
60+
}
61+
EOF
62+
)
63+
64+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
65+
-H "Content-Type: application/json" \
66+
-d "$EMAIL_BODY" || echo "Failed to send notification"
67+
68+
- name: Fail Pipeline if Quota Check Fails
69+
if: env.QUOTA_FAILED == 'true'
70+
run: exit 1
71+
72+
# The pipeline stops here if quota check fails!
73+
74+
- name: Set Deployment Region
75+
run: |
76+
echo "Selected Region: $VALID_REGION"
77+
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
78+
3279
- name: Login to GitHub Container Registry
3380
uses: docker/login-action@v3
3481
with:
@@ -51,7 +98,7 @@ jobs:
5198
uses: devcontainers/[email protected]
5299
env:
53100
AZURE_ENV_NAME: ${{ github.run_id }}
54-
AZURE_LOCATION: ${{ vars.AZURE_LOCATION }}
101+
AZURE_LOCATION: ${{ env.AZURE_LOCATION }}
55102
with:
56103
imageName: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
57104
cacheFrom: ghcr.io/azure-samples/chat-with-your-data-solution-accelerator
@@ -83,7 +130,7 @@ jobs:
83130
AZURE_SUBSCRIPTION_ID
84131
AZURE_ENV_NAME
85132
AZURE_LOCATION
86-
133+
87134
- name: Send Notification on Failure
88135
if: failure()
89136
run: |

.github/workflows/create-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88
contents: write
99
pull-requests: write
1010

11-
name: create-release
11+
name: Create-Release
1212

1313
jobs:
1414
create-release:

.github/workflows/pr-title-checker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "pr-title-checker"
1+
name: "PR Title Checker"
22

33
on:
44
pull_request_target:

0 commit comments

Comments
 (0)