Skip to content

Commit 3a019d7

Browse files
Merge pull request #110 from microsoft/dev
Dev changes sync to main
2 parents 84cf646 + e13bffc commit 3a019d7

File tree

117 files changed

+13354
-2112
lines changed

Some content is hidden

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

117 files changed

+13354
-2112
lines changed

.github/CODEOWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Lines starting with '#' are comments.
2+
# Each line is a file pattern followed by one or more owners.
3+
4+
# These owners will be the default owners for everything in the repo.
5+
* @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft
6+
7+
# Specific directory ownership
8+
/ClientAdvisor/ @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft
9+
10+
/ResearchAssistant/ @Avijit-Microsoft @Roopan-Microsoft @Prajwal-Microsoft

.github/dependabot.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
version: 2
2+
updates:
3+
# 1. React (JavaScript/TypeScript) dependencies
4+
- package-ecosystem: "npm"
5+
directory: "/ClientAdvisor/App/frontend"
6+
schedule:
7+
interval: "monthly"
8+
commit-message:
9+
prefix: "build"
10+
target-branch: "dependabotchanges"
11+
open-pull-requests-limit: 15
12+
13+
- package-ecosystem: "npm"
14+
directory: "/ResearchAssistant/App/frontend"
15+
schedule:
16+
interval: "monthly"
17+
commit-message:
18+
prefix: "build"
19+
target-branch: "dependabotchanges"
20+
open-pull-requests-limit: 15
21+
22+
# 2. Python dependencies
23+
- package-ecosystem: "pip"
24+
directory: "/ClientAdvisor/App"
25+
schedule:
26+
interval: "monthly"
27+
commit-message:
28+
prefix: "build"
29+
target-branch: "dependabotchanges"
30+
open-pull-requests-limit: 15
31+
32+
- package-ecosystem: "pip"
33+
directory: "/ClientAdvisor/AzureFunction"
34+
schedule:
35+
interval: "monthly"
36+
commit-message:
37+
prefix: "build"
38+
target-branch: "dependabotchanges"
39+
open-pull-requests-limit: 15
40+
41+
- package-ecosystem: "pip"
42+
directory: "/ClientAdvisor/Deployment/scripts/fabric_scripts"
43+
schedule:
44+
interval: "monthly"
45+
commit-message:
46+
prefix: "build"
47+
target-branch: "dependabotchanges"
48+
open-pull-requests-limit: 15
49+
50+
- package-ecosystem: "pip"
51+
directory: "/ClientAdvisor/Deployment/scripts/index_scripts"
52+
schedule:
53+
interval: "monthly"
54+
commit-message:
55+
prefix: "build"
56+
target-branch: "dependabotchanges"
57+
open-pull-requests-limit: 15
58+
59+
- package-ecosystem: "pip"
60+
directory: "/ResearchAssistant/App"
61+
schedule:
62+
interval: "monthly"
63+
commit-message:
64+
prefix: "build"
65+
target-branch: "dependabotchanges"
66+
open-pull-requests-limit: 15
67+
68+
- package-ecosystem: "pip"
69+
directory: "/ResearchAssistant/Deployment/scripts/aihub_scripts"
70+
schedule:
71+
interval: "monthly"
72+
commit-message:
73+
prefix: "build"
74+
target-branch: "dependabotchanges"
75+
open-pull-requests-limit: 15
76+
77+
- package-ecosystem: "pip"
78+
directory: "/ResearchAssistant/Deployment/scripts/fabric_scripts"
79+
schedule:
80+
interval: "monthly"
81+
commit-message:
82+
prefix: "build"
83+
target-branch: "dependabotchanges"
84+
open-pull-requests-limit: 15
85+
86+
- package-ecosystem: "pip"
87+
directory: "/ResearchAssistant/Deployment/scripts/index_scripts"
88+
schedule:
89+
interval: "monthly"
90+
commit-message:
91+
prefix: "build"
92+
target-branch: "dependabotchanges"
93+
open-pull-requests-limit: 16

.github/workflows/CAdeploy.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: CI-Validate Deployment-Client Advisor
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'ClientAdvisor/**'
9+
schedule:
10+
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout Code
18+
uses: actions/checkout@v3
19+
20+
- name: Setup Azure CLI
21+
run: |
22+
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
23+
az --version # Verify installation
24+
25+
- name: Login to Azure
26+
run: |
27+
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
28+
29+
- name: Install Bicep CLI
30+
run: az bicep install
31+
32+
- name: Generate Resource Group Name
33+
id: generate_rg_name
34+
run: |
35+
echo "Generating a unique resource group name..."
36+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
37+
COMMON_PART="pslautomationCli"
38+
UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}"
39+
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
40+
echo "Generated RESOURCE_GROUP_PREFIX: ${UNIQUE_RG_NAME}"
41+
42+
- name: Check and Create Resource Group
43+
id: check_create_rg
44+
run: |
45+
echo "RESOURCE_GROUP: ${{ env.RESOURCE_GROUP_NAME }}"
46+
set -e
47+
echo "Checking if resource group exists..."
48+
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
49+
if [ "$rg_exists" = "false" ]; then
50+
echo "Resource group does not exist. Creating..."
51+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location uksouth || { echo "Error creating resource group"; exit 1; }
52+
else
53+
echo "Resource group already exists."
54+
fi
55+
56+
- name: Generate Unique Solution Prefix
57+
id: generate_solution_prefix
58+
run: |
59+
set -e
60+
COMMON_PART="pslc"
61+
TIMESTAMP=$(date +%s)
62+
UPDATED_TIMESTAMP=$(echo $TIMESTAMP | tail -c 3)
63+
UNIQUE_SOLUTION_PREFIX="${COMMON_PART}${UPDATED_TIMESTAMP}"
64+
echo "SOLUTION_PREFIX=${UNIQUE_SOLUTION_PREFIX}" >> $GITHUB_ENV
65+
echo "Generated SOLUTION_PREFIX: ${UNIQUE_SOLUTION_PREFIX}"
66+
67+
- name: Deploy Bicep Template
68+
id: deploy
69+
run: |
70+
set -e
71+
az deployment group create \
72+
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
73+
--template-file ClientAdvisor/Deployment/bicep/main.bicep \
74+
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }} cosmosLocation=eastus2
75+
76+
- name: Update PowerBI URL
77+
if: success()
78+
run: |
79+
set -e
80+
81+
COMMON_PART="-app-service"
82+
application_name="${{ env.SOLUTION_PREFIX }}${COMMON_PART}"
83+
echo "Updating application: $application_name"
84+
85+
# Log the Power BI URL being set
86+
echo "Setting Power BI URL: ${{ vars.VITE_POWERBI_EMBED_URL }}"
87+
88+
# Update the application settings
89+
az webapp config appsettings set --name "$application_name" --resource-group "${{ env.RESOURCE_GROUP_NAME }}" --settings VITE_POWERBI_EMBED_URL="${{ vars.VITE_POWERBI_EMBED_URL }}"
90+
91+
# Restart the web app
92+
az webapp restart --resource-group "${{ env.RESOURCE_GROUP_NAME }}" --name "$application_name"
93+
94+
echo "Power BI URL updated successfully for application: $application_name."
95+
96+
- name: Delete Bicep Deployment
97+
if: success()
98+
run: |
99+
set -e
100+
echo "Checking if resource group exists..."
101+
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
102+
if [ "$rg_exists" = "true" ]; then
103+
echo "Resource group exist. Cleaning..."
104+
az group delete \
105+
--name ${{ env.RESOURCE_GROUP_NAME }} \
106+
--yes \
107+
--no-wait
108+
echo "Resource group deleted... ${{ env.RESOURCE_GROUP_NAME }}"
109+
else
110+
echo "Resource group does not exists."
111+
fi
112+
113+
- name: Send Notification on Failure
114+
if: failure()
115+
run: |
116+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
117+
118+
# Construct the email body
119+
EMAIL_BODY=$(cat <<EOF
120+
{
121+
"body": "<p>Dear Team,</p><p>We would like to inform you that the Client Advisor Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
122+
}
123+
EOF
124+
)
125+
126+
# Send the notification
127+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
128+
-H "Content-Type: application/json" \
129+
-d "$EMAIL_BODY" || echo "Failed to send notification"
130+

.github/workflows/RAdeploy.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: CI-Validate Deployment-Research Assistant
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'ResearchAssistant/**'
9+
schedule:
10+
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Code
17+
uses: actions/checkout@v3
18+
19+
- name: Setup Azure CLI
20+
run: |
21+
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
22+
az --version # Verify installation
23+
24+
- name: Login to Azure
25+
run: |
26+
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
27+
28+
- name: Install Bicep CLI
29+
run: az bicep install
30+
31+
- name: Generate Resource Group Name
32+
id: generate_rg_name
33+
run: |
34+
echo "Generating a unique resource group name..."
35+
TIMESTAMP=$(date +%Y%m%d%H%M%S)
36+
COMMON_PART="pslautomationRes"
37+
UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}"
38+
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
39+
echo "Generated Resource_GROUP_PREFIX: ${UNIQUE_RG_NAME}"
40+
41+
- name: Check and Create Resource Group
42+
id: check_create_rg
43+
run: |
44+
set -e
45+
echo "Checking if resource group exists..."
46+
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
47+
if [ "$rg_exists" = "false" ]; then
48+
echo "Resource group does not exist. Creating..."
49+
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location eastus2 || { echo "Error creating resource group"; exit 1; }
50+
else
51+
echo "Resource group already exists."
52+
fi
53+
54+
- name: Generate Unique Solution Prefix
55+
id: generate_solution_prefix
56+
run: |
57+
set -e
58+
COMMON_PART="pslr"
59+
TIMESTAMP=$(date +%s)
60+
UPDATED_TIMESTAMP=$(echo $TIMESTAMP | tail -c 3)
61+
UNIQUE_SOLUTION_PREFIX="${COMMON_PART}${UPDATED_TIMESTAMP}"
62+
echo "SOLUTION_PREFIX=${UNIQUE_SOLUTION_PREFIX}" >> $GITHUB_ENV
63+
echo "Generated SOLUTION_PREFIX: ${UNIQUE_SOLUTION_PREFIX}"
64+
65+
- name: Deploy Bicep Template
66+
id: deploy
67+
run: |
68+
set -e
69+
az deployment group create \
70+
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
71+
--template-file ResearchAssistant/Deployment/bicep/main.bicep \
72+
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }}
73+
74+
- name: Delete Bicep Deployment
75+
if: success()
76+
run: |
77+
set -e
78+
echo "Checking if resource group exists..."
79+
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
80+
if [ "$rg_exists" = "true" ]; then
81+
echo "Resource group exist. Cleaning..."
82+
az group delete \
83+
--name ${{ env.RESOURCE_GROUP_NAME }} \
84+
--yes \
85+
--no-wait
86+
echo "Resource group deleted... ${{ env.RESOURCE_GROUP_NAME }}"
87+
else
88+
echo "Resource group does not exists."
89+
fi
90+
91+
- name: Send Notification on Failure
92+
if: failure()
93+
run: |
94+
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
95+
96+
# Construct the email body
97+
EMAIL_BODY=$(cat <<EOF
98+
{
99+
"body": "<p>Dear Team,</p><p>We would like to inform you that the Research Assistant Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>"
100+
}
101+
EOF
102+
)
103+
104+
# Send the notification
105+
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
106+
-H "Content-Type: application/json" \
107+
-d "$EMAIL_BODY" || echo "Failed to send notification"
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build ClientAdvisor Docker Images
2+
3+
on:
4+
push:
5+
branches: [main, dev, demo]
6+
paths:
7+
- ClientAdvisor/**
8+
pull_request:
9+
branches: [main, dev, demo]
10+
types:
11+
- opened
12+
- ready_for_review
13+
- reopened
14+
- synchronize
15+
paths:
16+
- ClientAdvisor/**
17+
merge_group:
18+
19+
jobs:
20+
docker-build:
21+
strategy:
22+
matrix:
23+
include:
24+
- app_name: byc-wa-app
25+
dockerfile: ClientAdvisor/App/WebApp.Dockerfile
26+
password_secret: DOCKER_PASSWORD
27+
- app_name: byc-wa-fn
28+
dockerfile: ClientAdvisor/AzureFunction/Dockerfile
29+
password_secret: DOCKER_PASSWORD
30+
31+
uses: ./.github/workflows/build-docker.yml
32+
with:
33+
registry: bycwacontainerreg.azurecr.io
34+
username: bycwacontainerreg
35+
password_secret: ${{ matrix.password_secret }}
36+
app_name: ${{ matrix.app_name }}
37+
dockerfile: ${{ matrix.dockerfile }}
38+
push: ${{ github.event_name == 'push' && github.ref_name == 'main' || github.ref_name == 'dev' || github.ref_name == 'demo' }}
39+
secrets: inherit

0 commit comments

Comments
 (0)