Skip to content

Commit 9d567a1

Browse files
Merge branch 'dev' into section-generate-fix
2 parents 05c34cd + ae9438c commit 9d567a1

52 files changed

Lines changed: 9655 additions & 1631 deletions

Some content is hidden

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

.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: 39 additions & 28 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,26 +40,34 @@ 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-
fi
43+
- name: Get current date
44+
id: date
45+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
5046

51-
- name: Build and push Docker image
52-
if: ${{ github.ref_name == 'main' }}
53-
run: |
54-
docker build -t ${{ secrets.ACR_LOGIN_SERVER }}/webapp:${{ env.TAG }} -f WebApp.Dockerfile .
55-
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
5650

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

.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/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: 5 additions & 5 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

WebApp.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ USER node
77
RUN npm ci
88
COPY --chown=node:node ./frontend/ ./frontend
99
WORKDIR /home/node/app/frontend
10+
RUN npm install --save-dev @types/node @types/jest
1011
RUN NODE_OPTIONS=--max_old_space_size=8192 npm run build
1112

1213
FROM python:3.11-alpine
@@ -27,4 +28,4 @@ COPY --from=frontend /home/node/app/static /usr/src/app/static/
2728
WORKDIR /usr/src/app
2829
EXPOSE 80
2930

30-
CMD ["gunicorn" , "-b", "0.0.0.0:80", "app:app"]
31+
CMD ["gunicorn" , "-b", "0.0.0.0:80", "app:app"]

docs/README_LOCAL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ NOTE: You may find you need to set: MacOS: `export NODE_OPTIONS="--max-old-space
2727
[More information about Azure OpenAI on your data](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/concepts/use-your-data)
2828

2929
1. Update the `AZURE_OPENAI_*` environment variables as described above.
30-
2. To connect to your data, you need to specify an Azure Cognitive Search index to use. You can [create this index yourself](https://learn.microsoft.com/en-us/azure/search/search-get-started-portal) or use the [Azure AI Studio](https://oai.azure.com/portal/chat) to create the index for you.
30+
2. To connect to your data, you need to specify an Azure Cognitive Search index to use. You can [create this index yourself](https://learn.microsoft.com/en-us/azure/search/search-get-started-portal) or use the [Azure AI Foundry](https://oai.azure.com/portal/chat) to create the index for you.
3131

3232
These variables are required when adding your data with Azure AI Search:
3333
- `DATASOURCE_TYPE` (should be set to `AzureCognitiveSearch`)

0 commit comments

Comments
 (0)