Skip to content

Commit 27f4726

Browse files
Merge branch 'dev' into dependabotchanges
2 parents c26e9fc + ae9438c commit 27f4726

Some content is hidden

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

54 files changed

+9475
-583
lines changed

.github/workflows/deploy.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: CI-Validate Deployment
1+
name: Validate Deployment
22

33
on:
44
push:
55
branches:
66
- main
77
schedule:
8-
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
8+
- cron: '0 9,21 * * *' # Runs at 9:00 AM and 9:00 PM GMT
99

1010
jobs:
1111
deploy:
@@ -23,8 +23,52 @@ jobs:
2323
run: |
2424
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
2525
26+
- name: Run Quota Check
27+
id: quota-check
28+
run: |
29+
export AZURE_CLIENT_ID=${{ secrets.AZURE_CLIENT_ID }}
30+
export AZURE_TENANT_ID=${{ secrets.AZURE_TENANT_ID }}
31+
export AZURE_CLIENT_SECRET=${{ secrets.AZURE_CLIENT_SECRET }}
32+
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
33+
export GPT_MIN_CAPACITY="30"
34+
export TEXT_EMBEDDING_MIN_CAPACITY="30"
35+
36+
chmod +x scripts/checkquota.sh
37+
if ! scripts/checkquota.sh; then
38+
# If quota check fails due to insufficient quota, set the flag
39+
if grep -q "No region with sufficient quota found" scripts/checkquota.sh; then
40+
echo "QUOTA_FAILED=true" >> $GITHUB_ENV
41+
fi
42+
exit 1 # Fail the pipeline if any other failure occurs
43+
fi
44+
45+
46+
- name: Send Notification on Quota Failure
47+
if: env.QUOTA_FAILED == 'true'
48+
run: |
49+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
50+
EMAIL_BODY=$(cat <<EOF
51+
{
52+
"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>"
53+
}
54+
EOF
55+
)
56+
57+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
58+
-H "Content-Type: application/json" \
59+
-d "$EMAIL_BODY" || echo "Failed to send notification"
60+
61+
- name: Fail Pipeline if Quota Check Fails
62+
if: env.QUOTA_FAILED == 'true'
63+
run: exit 1
64+
2665
- name: Install Bicep CLI
2766
run: az bicep install
67+
68+
- name: Set Deployment Region
69+
run: |
70+
echo "Selected Region: $VALID_REGION"
71+
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
2872
2973
- name: Generate Resource Group Name
3074
id: generate_rg_name
@@ -44,7 +88,7 @@ jobs:
4488
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
4589
if [ "$rg_exists" = "false" ]; then
4690
echo "Resource group does not exist. Creating..."
47-
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location northcentralus || { echo "Error creating resource group"; exit 1; }
91+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location ${{ env.AZURE_LOCATION }} || { echo "Error creating resource group"; exit 1; }
4892
else
4993
echo "Resource group already exists."
5094
fi
@@ -72,7 +116,7 @@ jobs:
72116
ApplicationInsightsName="appins-${{ env.SOLUTION_PREFIX }}" \
73117
WebsiteName="webapp-${{ env.SOLUTION_PREFIX }}" \
74118
CosmosDBName="db-cosmos-${{ env.SOLUTION_PREFIX }}" \
75-
CosmosDBRegion="NorthCentralUS" \
119+
CosmosDBRegion="${{ env.AZURE_LOCATION }}" \
76120
AzureSearchService="search-${{ env.SOLUTION_PREFIX }}" \
77121
AzureOpenAIResource="aoai-${{ env.SOLUTION_PREFIX }}" \
78122
WorkspaceName="worksp-${{ env.SOLUTION_PREFIX }}"
Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
name: Build and Push Docker Image
1+
name: Build Docker and Optional Push
22

33
on:
4+
push:
5+
branches: [main, dev, demo]
46
pull_request:
5-
types: [closed]
6-
branches:
7-
- main
8-
- dev
9-
- demo
10-
workflow_dispatch: # Add this line to enable manual triggering
7+
branches: [main, dev, demo]
8+
types:
9+
- opened
10+
- ready_for_review
11+
- reopened
12+
- synchronize
13+
merge_group:
14+
workflow_dispatch:
1115

1216
jobs:
1317
build-and-push:
14-
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
1518
runs-on: ubuntu-latest
1619

1720
steps:
@@ -37,28 +40,36 @@ jobs:
3740
username: ${{ secrets.ACR_DEV_USERNAME }}
3841
password: ${{ secrets.ACR_DEV_PASSWORD }}
3942

40-
- name: Set Docker image tag
41-
id: docker_tag
42-
run: |
43-
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
44-
echo "TAG=latest" >> $GITHUB_ENV
45-
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
46-
echo "TAG=dev" >> $GITHUB_ENV
47-
elif [[ "${{ github.ref }}" == "refs/heads/demo" ]]; then
48-
echo "TAG=demo" >> $GITHUB_ENV
49-
elif [[ "${{ github.ref }}" == "refs/heads/dependabotchanges" ]]; then
50-
echo "TAG=dependabotchanges" >> $GITHUB_ENV
51-
fi
43+
- name: Get current date
44+
id: date
45+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
5246

53-
- name: Build and push Docker image
54-
if: ${{ github.ref_name == 'main' }}
55-
run: |
56-
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/webapp:${{ env.TAG }} -f WebApp.Dockerfile .
57-
docker push ${{ secrets.ACR_LOGIN_SERVER }}/webapp:${{ env.TAG }}
47+
- name: Get registry
48+
id: registry
49+
run: echo "registry=${{ github.ref_name == 'main' && secrets.ACR_LOGIN_SERVER || secrets.ACR_DEV_LOGIN_SERVER }}" >> $GITHUB_OUTPUT
5850

59-
- name: Build and push Docker image (Dev/Demo)
60-
if: ${{ github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'dependabotchanges' }}
51+
- name: Determine Tag Name Based on Branch
52+
id: determine_tag
6153
run: |
62-
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/webapp:latest -f WebApp.Dockerfile .
63-
docker push ${{ secrets.ACR_LOGIN_SERVER }}/webapp:latest
64-
54+
if [[ "${{ github.ref_name }}" == "main" ]]; then
55+
echo "tagname=latest" >> $GITHUB_OUTPUT
56+
elif [[ "${{ github.ref_name }}" == "dev" ]]; then
57+
echo "tagname=dev" >> $GITHUB_OUTPUT
58+
elif [[ "${{ github.ref_name }}" == "demo" ]]; then
59+
echo "tagname=demo" >> $GITHUB_OUTPUT
60+
elif [[ "${{ github.ref_name }}" == "dependabotchanges" ]]; then
61+
echo "tagname=dependabotchanges" >> $GITHUB_OUTPUT
62+
else
63+
echo "tagname=default" >> $GITHUB_OUTPUT
64+
65+
fi
66+
67+
- name: Build Docker Image and optionally push
68+
uses: docker/build-push-action@v6
69+
with:
70+
context: .
71+
file: WebApp.Dockerfile
72+
push: ${{ github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' || github.ref_name == 'dependabotchanges' }}
73+
tags: |
74+
${{ steps.registry.outputs.registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}
75+
${{ steps.registry.outputs.registry }}/webapp:${{ steps.determine_tag.outputs.tagname }}_${{ steps.date.outputs.date }}_${{ github.run_number }}

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
working-directory: frontend
1919
strategy:
2020
matrix:
21-
node-version: [14.x, 16.x, 18.x, 21.x]
21+
node-version: [16.x, 18.x, 21.x]
2222
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2323

2424
steps:

.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/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Code Quality Workflow
1+
name: PyLint
22

33
on: [push]
44

.github/workflows/stale-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Close stale issues and PRs'
1+
name: 'Stale Bot'
22
on:
33
schedule:
44
- cron: '30 1 * * *'

.github/workflows/sync-branches.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.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:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ __pycache__/
77
static
88
scripts/config.json
99
venv
10-
myenv
10+
myenv
11+
frontend/coverage

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ User story
1515

1616
This solution accelerator is a powerful tool that helps you create your own AI assistant(s). The accelerator can be used by any customer looking for reusable architecture and code snippets to build an AI assistant(s) with their own enterprise data.
1717

18-
It leverages Azure Open AI Service and Azure AI Search, to identify relevant documents, summarize unstructured information, and generate Word document templates using your own data.
18+
It leverages Azure OpenAI Service and Azure AI Search, to identify relevant documents, summarize unstructured information, and generate Word document templates using your own data.
1919

2020
**Scenario**
2121

@@ -44,13 +44,13 @@ One-click deploy
4444

4545
### Prerequisites
4646

47-
To use this solution accelerator, you will need access to an [Azure subscription](https://azure.microsoft.com/free/) with permission to create resource groups and resources. While not required, a prior understanding of Azure Open AI and Azure AI Search will be helpful.
47+
To use this solution accelerator, you will need access to an [Azure subscription](https://azure.microsoft.com/free/) with permission to create resource groups and resources. While not required, a prior understanding of Azure OpenAI and Azure AI Search will be helpful.
4848

4949
For additional training and support, please see:
5050

51-
1. [Azure Open AI](https://learn.microsoft.com/en-us/azure/ai-services/openai/)
51+
1. [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/)
5252
2. [Azure AI Search](https://learn.microsoft.com/en-us/azure/search/)
53-
3. [Azure AI Studio](https://learn.microsoft.com/en-us/azure/ai-studio/)
53+
3. [Azure AI Foundry](https://learn.microsoft.com/en-us/azure/ai-studio/)
5454

5555
### Solution accelerator architecture
5656
![image](/docs/images/architecture.png)
@@ -62,7 +62,7 @@ For additional training and support, please see:
6262
### **How to install/deploy**
6363

6464
1. Please check the link [Azure Products by Region](
65-
https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/?products=all&regions=all) and choose a region where Azure AI Search, Azure OpenAI Service, and Azure AI Studio are available. If you are using the included sample data set, verify Document Intelligence (Form Recognizer) is available.
65+
https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-region/?products=all&regions=all) and choose a region where Azure AI Search, Azure OpenAI Service, and Azure AI Foundry are available. If you are using the included sample data set, verify Document Intelligence (Form Recognizer) is available.
6666

6767
2. Click the following deployment button to create the required resources for this accelerator in your Azure Subscription.
6868

@@ -72,7 +72,7 @@ https://azure.microsoft.com/en-us/explore/global-infrastructure/products-by-regi
7272

7373
If you are using your own data, the next step is optional.
7474

75-
4. Optional - Follow steps in [Sample data guide](./scripts/SAMPLE_DATA.md) to ingest the sample Promissory Note PDFs into the search index.
75+
4. Follow steps in [Sample data guide](./scripts/SAMPLE_DATA.md) to ingest the sample Promissory Note PDFs into the search index.
7676

7777
If you want to enable authentication, you will need to add an identity provider.
7878

0 commit comments

Comments
 (0)