Skip to content

Commit ccd781d

Browse files
Merge branch 'main' into demo
2 parents 3f5713f + d0269a9 commit ccd781d

File tree

86 files changed

+15390
-6462
lines changed

Some content is hidden

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

86 files changed

+15390
-6462
lines changed

.env.sample

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ 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=gpt-35-turbo
26-
AZURE_OPENAI_MODEL_NAME=gpt-35-turbo
25+
AZURE_OPENAI_MODEL=gpt-4o
26+
AZURE_OPENAI_MODEL_NAME=gpt-4o
2727
AZURE_OPENAI_EMBEDDING_MODEL=text-embedding-ada-002
2828
AZURE_OPENAI_TEMPERATURE=0
2929
AZURE_OPENAI_TOP_P=1.0

.github/dependabot.yml

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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"

.github/workflows/build-docker-images.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Docker Images
1+
name: Build Docker and Optional Push
22

33
on:
44
push:
@@ -12,11 +12,12 @@ on:
1212
- dev
1313
- demo
1414
types:
15-
- opened
16-
- ready_for_review
17-
- reopened
18-
- synchronize
15+
- opened
16+
- ready_for_review
17+
- reopened
18+
- synchronize
1919
merge_group:
20+
workflow_dispatch:
2021

2122
jobs:
2223
docker-build:
@@ -31,9 +32,11 @@ jobs:
3132
dockerfile: docker/Frontend.Dockerfile
3233
uses: ./.github/workflows/build-docker.yml
3334
with:
34-
registry: ${{ github.ref_name == 'main' && 'fruoccopublic.azurecr.io' || 'cwydcontainerreg.azurecr.io'}}
35-
username: ${{ github.ref_name == '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'
3639
app_name: ${{ matrix.app_name }}
3740
dockerfile: ${{ matrix.dockerfile }}
38-
push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' }}
41+
push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo'|| github.ref_name == 'dependabotchanges' }}
3942
secrets: inherit

.github/workflows/build-docker.yml

Lines changed: 41 additions & 12 deletions
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:
@@ -31,20 +37,30 @@ jobs:
3137
- name: Checkout
3238
uses: actions/checkout@v4
3339

34-
- name: Docker Login
40+
# Login for 'main' branch to both registries
41+
- name: Docker Login to fruoccopublic (Main)
3542
if: ${{ inputs.push == true && github.ref_name == 'main' }}
3643
uses: docker/login-action@v3
3744
with:
38-
registry: ${{ inputs.registry }}
39-
username: ${{ inputs.username }}
45+
registry: ${{ inputs.old_registry }}
46+
username: ${{ inputs.old_username }}
4047
password: ${{ secrets.DOCKER_PASSWORD }}
4148

42-
- 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)
4359
if: ${{ inputs.push == true && (github.ref_name == 'dev' || github.ref_name == 'demo') }}
4460
uses: docker/login-action@v3
4561
with:
46-
registry: ${{ inputs.registry }}
47-
username: ${{ inputs.username }}
62+
registry: ${{ inputs.new_registry }}
63+
username: ${{ inputs.new_username }}
4864
password: ${{ secrets.DEV_DOCKER_PASSWORD }}
4965

5066
- name: Set up Docker Buildx
@@ -54,13 +70,26 @@ jobs:
5470
id: date
5571
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
5672

57-
- 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' }}
5887
uses: docker/build-push-action@v6
5988
with:
6089
context: .
6190
file: ${{ inputs.dockerfile }}
6291
push: ${{ inputs.push }}
63-
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' || github.head_ref || github.ref_name }}
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 }}
6493
tags: |
65-
${{ inputs.registry }}/${{ inputs.app_name}}:${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || github.head_ref || 'default' }}
66-
${{ 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

Lines changed: 51 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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:

.github/workflows/stale-bot.yml

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,82 @@
1-
name: 'Close stale issues and PRs'
1+
name: "Manage Stale Issues, PRs & Unmerged Branches"
22
on:
33
schedule:
4-
- cron: '30 1 * * *'
5-
4+
- cron: '30 1 * * *' # Runs daily at 1:30 AM UTC
5+
workflow_dispatch: # Allows manual triggering
66
permissions:
77
contents: write
88
issues: write
99
pull-requests: write
10-
1110
jobs:
1211
stale:
1312
runs-on: ubuntu-latest
1413
steps:
15-
- uses: actions/stale@v9
14+
- name: Mark Stale Issues and PRs
15+
uses: actions/stale@v9
1616
with:
17-
stale-issue-message: 'This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 30 days.'
17+
stale-issue-message: "This issue is stale because it has been open 180 days with no activity. Remove stale label or comment, or it will be closed in 30 days."
18+
stale-pr-message: "This PR is stale because it has been open 180 days with no activity. Please update or it will be closed in 30 days."
1819
days-before-stale: 180
1920
days-before-close: 30
21+
exempt-issue-labels: "keep"
22+
exempt-pr-labels: "keep"
23+
cleanup-branches:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout Repository
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0 # Fetch full history for accurate branch checks
30+
- name: Fetch All Branches
31+
run: git fetch --all --prune
32+
- name: List Merged Branches With No Activity in Last 3 Months
33+
run: |
34+
35+
echo "Branch Name,Last Commit Date,Committer,Committed In Branch,Action" > merged_branches_report.csv
36+
37+
for branch in $(git for-each-ref --format '%(refname:short) %(committerdate:unix)' refs/remotes/origin | awk -v date=$(date -d '3 months ago' +%s) '$2 < date {print $1}'); do
38+
if [[ "$branch" != "origin/main" && "$branch" != "origin/dev" ]]; then
39+
branch_name=${branch#origin/}
40+
# Ensure the branch exists locally before getting last commit date
41+
git fetch origin "$branch_name" || echo "Could not fetch branch: $branch_name"
42+
last_commit_date=$(git log -1 --format=%ci "origin/$branch_name" || echo "Unknown")
43+
committer_name=$(git log -1 --format=%cn "origin/$branch_name" || echo "Unknown")
44+
committed_in_branch=$(git branch -r --contains "origin/$branch_name" | tr -d ' ' | paste -sd "," -)
45+
echo "$branch_name,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
46+
fi
47+
done
48+
- name: List PR Approved and Merged Branches Older Than 30 Days
49+
run: |
50+
51+
for branch in $(gh api repos/${{ github.repository }}/pulls --jq '.[] | select(.merged_at != null and (.base.ref == "main" or .base.ref == "dev")) | select(.merged_at | fromdateiso8601 < (now - 2592000)) | .head.ref'); do
52+
# Ensure the branch exists locally before getting last commit date
53+
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
54+
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
55+
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")
56+
committed_in_branch=$(git branch -r --contains "origin/$branch" | tr -d ' ' | paste -sd "," -)
57+
echo "$branch,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
58+
done
59+
env:
60+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
- name: List Open PR Branches With No Activity in Last 3 Months
62+
run: |
63+
64+
for branch in $(gh api repos/${{ github.repository }}/pulls --state open --jq '.[] | select(.base.ref == "main" or .base.ref == "dev") | .head.ref'); do
65+
# Ensure the branch exists locally before getting last commit date
66+
git fetch origin "$branch" || echo "Could not fetch branch: $branch"
67+
last_commit_date=$(git log -1 --format=%ci origin/$branch || echo "Unknown")
68+
committer_name=$(git log -1 --format=%cn origin/$branch || echo "Unknown")
69+
if [[ $(date -d "$last_commit_date" +%s) -lt $(date -d '3 months ago' +%s) ]]; then
70+
# If no commit in the last 3 months, mark for deletion
71+
committed_in_branch=$(git branch -r --contains "origin/$branch" | tr -d ' ' | paste -sd "," -)
72+
echo "$branch,$last_commit_date,$committer_name,$committed_in_branch,Delete" >> merged_branches_report.csv
73+
fi
74+
done
75+
env:
76+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
- name: Upload CSV Report of Inactive Branches
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: merged-branches-report
81+
path: merged_branches_report.csv
82+
retention-days: 30

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Tests
1+
name: Test Workflow with Coverage
22

33
on:
44
push:

0 commit comments

Comments
 (0)