Skip to content

Commit 23cbe2c

Browse files
Merge branch 'main' into dev
2 parents 9cbfca2 + 0d32e01 commit 23cbe2c

File tree

6 files changed

+81
-95
lines changed

6 files changed

+81
-95
lines changed

.github/workflows/CAdeploy.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,16 @@ jobs:
7474
- name: Install Bicep CLI
7575
run: az bicep install
7676

77+
7778
- name: Generate Resource Group Name
7879
id: generate_rg_name
7980
run: |
8081
echo "Generating a unique resource group name..."
81-
TIMESTAMP=$(date +%Y%m%d%H%M%S)
82-
COMMON_PART="pslautomationCli"
83-
UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}"
82+
ACCL_NAME="cabyoc" # Account name as specified
83+
SHORT_UUID=$(uuidgen | cut -d'-' -f1)
84+
UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
8485
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
85-
echo "Generated RESOURCE_GROUP_PREFIX: ${UNIQUE_RG_NAME}"
86+
echo "Generated RESOURCE_GROUP_NAME: ${UNIQUE_RG_NAME}"
8687
8788
- name: Check and Create Resource Group
8889
id: check_create_rg

.github/workflows/RAdeploy.yml

Lines changed: 68 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
export GPT_MIN_CAPACITY="30"
2727
export TEXT_EMBEDDING_MIN_CAPACITY="45"
2828
export AZURE_REGIONS="${{ vars.AZURE_REGIONS_RA }}"
29-
3029
chmod +x ResearchAssistant/Deployment/scripts/checkquota.sh
3130
if ! ResearchAssistant/Deployment/scripts/checkquota.sh; then
3231
# If quota check fails due to insufficient quota, set the flag
@@ -47,11 +46,9 @@ jobs:
4746
}
4847
EOF
4948
)
50-
5149
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \
5250
-H "Content-Type: application/json" \
5351
-d "$EMAIL_BODY" || echo "Failed to send notification"
54-
5552
- name: Fail Pipeline if Quota Check Fails
5653
if: env.QUOTA_FAILED == 'true'
5754
run: exit 1
@@ -60,28 +57,25 @@ jobs:
6057
run: |
6158
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
6259
az --version # Verify installation
63-
6460
- name: Login to Azure
6561
run: |
6662
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
67-
6863
- name: Install Bicep CLI
6964
run: az bicep install
7065

7166
- name: Set Deployment Region
7267
run: |
7368
echo "Selected Region: $VALID_REGION"
7469
echo "AZURE_LOCATION=$VALID_REGION" >> $GITHUB_ENV
75-
7670
- name: Generate Resource Group Name
7771
id: generate_rg_name
7872
run: |
7973
echo "Generating a unique resource group name..."
80-
TIMESTAMP=$(date +%Y%m%d%H%M%S)
81-
COMMON_PART="pslautomationRes"
82-
UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}"
74+
ACCL_NAME="rabyoc" # Account name as specified
75+
SHORT_UUID=$(uuidgen | cut -d'-' -f1)
76+
UNIQUE_RG_NAME="arg-${ACCL_NAME}-${SHORT_UUID}"
8377
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV
84-
echo "Generated Resource_GROUP_PREFIX: ${UNIQUE_RG_NAME}"
78+
echo "Generated RESOURCE_GROUP_NAME: ${UNIQUE_RG_NAME}"
8579
8680
- name: Check and Create Resource Group
8781
id: check_create_rg
@@ -95,7 +89,6 @@ jobs:
9589
else
9690
echo "Resource group already exists."
9791
fi
98-
9992
- name: Generate Unique Solution Prefix
10093
id: generate_solution_prefix
10194
run: |
@@ -106,7 +99,6 @@ jobs:
10699
UNIQUE_SOLUTION_PREFIX="${COMMON_PART}${UPDATED_TIMESTAMP}"
107100
echo "SOLUTION_PREFIX=${UNIQUE_SOLUTION_PREFIX}" >> $GITHUB_ENV
108101
echo "Generated SOLUTION_PREFIX: ${UNIQUE_SOLUTION_PREFIX}"
109-
110102
- name: Deploy Bicep Template
111103
id: deploy
112104
run: |
@@ -115,23 +107,19 @@ jobs:
115107
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
116108
--template-file ResearchAssistant/Deployment/bicep/main.bicep \
117109
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }}
118-
119110
- name: List KeyVaults and Store in Array
120111
id: list_keyvaults
121112
run: |
122-
123113
set -e
124114
echo "Listing all KeyVaults in the resource group ${RESOURCE_GROUP_NAME}..."
125115
126116
# Get the list of KeyVaults in the specified resource group
127117
keyvaults=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --query "[?type=='Microsoft.KeyVault/vaults'].name" -o tsv)
128-
129118
if [ -z "$keyvaults" ]; then
130119
echo "No KeyVaults found in resource group ${RESOURCE_GROUP_NAME}."
131120
echo "KEYVAULTS=[]" >> $GITHUB_ENV # If no KeyVaults found, set an empty array
132121
else
133122
echo "KeyVaults found: $keyvaults"
134-
135123
# Format the list into an array with proper formatting (no trailing comma)
136124
keyvault_array="["
137125
first=true
@@ -144,101 +132,97 @@ jobs:
144132
fi
145133
done
146134
keyvault_array="$keyvault_array]"
147-
148135
# Output the formatted array and save it to the environment variable
149136
echo "KEYVAULTS=$keyvault_array" >> $GITHUB_ENV
150137
fi
151138
152139
- name: Delete Bicep Deployment
153-
if: success()
140+
if: always()
154141
run: |
155142
set -e
156143
echo "Checking if resource group exists..."
157144
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }})
158145
if [ "$rg_exists" = "true" ]; then
159-
echo "Resource group exist. Cleaning..."
160-
az group delete \
161-
--name ${{ env.RESOURCE_GROUP_NAME }} \
162-
--yes \
163-
--no-wait
164-
echo "Resource group deleted... ${{ env.RESOURCE_GROUP_NAME }}"
146+
echo "Resource group exists. Cleaning..."
147+
az group delete --name ${{ env.RESOURCE_GROUP_NAME }} --yes --no-wait
148+
echo "Initiated deletion of resource group: ${{ env.RESOURCE_GROUP_NAME }}"
149+
echo "Waiting for resource group deletion to complete..."
150+
az group wait --deleted --name ${{ env.RESOURCE_GROUP_NAME }}
151+
echo "Resource group deletion completed: ${{ env.RESOURCE_GROUP_NAME }}"
165152
else
166-
echo "Resource group does not exists."
153+
echo "Resource group does not exist."
167154
fi
168-
155+
169156
- name: Wait for resource deletion to complete
170157
run: |
171-
172-
# List of keyvaults
173-
KEYVAULTS="${{ env.KEYVAULTS }}"
174-
175-
# Remove the surrounding square brackets, if they exist
176-
stripped_keyvaults=$(echo "$KEYVAULTS" | sed 's/\[\|\]//g')
177-
178-
# Convert the comma-separated string into an array
179-
IFS=',' read -r -a resources_to_check <<< "$stripped_keyvaults"
180-
181-
# Append new resources to the array
182-
resources_to_check+=("${{ env.SOLUTION_PREFIX }}-openai" "${{ env.SOLUTION_PREFIX }}-cogser")
183-
184-
echo "List of resources to check: ${resources_to_check[@]}"
185-
186-
# Get the list of resources in YAML format
187-
resource_list=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --output yaml)
188-
189-
# Maximum number of retries
190-
max_retries=3
191-
192-
# Retry intervals in seconds (30, 60, 120)
193-
retry_intervals=(30 60 120)
194-
195-
# Retry mechanism to check resources
196-
retries=0
197-
while true; do
198-
resource_found=false
199-
200-
# Iterate through the resources to check
201-
for resource in "${resources_to_check[@]}"; do
202-
echo "Checking resource: $resource"
203-
if echo "$resource_list" | grep -q "name: $resource"; then
204-
echo "Resource '$resource' exists in the resource group."
205-
resource_found=true
158+
echo "Verifying if resource group '${{ env.RESOURCE_GROUP_NAME }}' still exists..."
159+
if az group exists --name ${{ env.RESOURCE_GROUP_NAME }} | grep -q "true"; then
160+
echo "Resource group exists. Proceeding with resource checks..."
161+
# List of keyvaults
162+
KEYVAULTS="${{ env.KEYVAULTS }}"
163+
# Remove the surrounding square brackets, if they exist
164+
stripped_keyvaults=$(echo "$KEYVAULTS" | sed 's/\[\|\]//g')
165+
166+
# Convert the comma-separated string into an array
167+
IFS=',' read -r -a resources_to_check <<< "$stripped_keyvaults"
168+
169+
# Append new resources to the array
170+
resources_to_check+=("${{ env.SOLUTION_PREFIX }}-openai" "${{ env.SOLUTION_PREFIX }}-cogser")
171+
echo "List of resources to check: ${resources_to_check[@]}"
172+
173+
# Get the list of resources in YAML format
174+
resource_list=$(az resource list --resource-group ${{ env.RESOURCE_GROUP_NAME }} --output yaml)
175+
176+
# Maximum number of retries
177+
max_retries=3
178+
# Retry intervals in seconds (30, 60, 120)
179+
retry_intervals=(30 60 120)
180+
181+
# Retry mechanism to check resources
182+
retries=0
183+
while true; do
184+
resource_found=false
185+
# Iterate through the resources to check
186+
for resource in "${resources_to_check[@]}"; do
187+
echo "Checking resource: $resource"
188+
if echo "$resource_list" | grep -q "name: $resource"; then
189+
echo "Resource '$resource' exists in the resource group."
190+
resource_found=true
191+
else
192+
echo "Resource '$resource' does not exist in the resource group."
193+
fi
194+
done
195+
196+
# If any resource exists, retry
197+
if [ "$resource_found" = true ]; then
198+
retries=$((retries + 1))
199+
if [ "$retries" -ge "$max_retries" ]; then
200+
echo "Maximum retry attempts reached. Exiting."
201+
break
202+
else
203+
# Wait for the appropriate interval for the current retry
204+
echo "Waiting for ${retry_intervals[$retries-1]} seconds before retrying..."
205+
sleep ${retry_intervals[$retries-1]}
206+
fi
206207
else
207-
echo "Resource '$resource' does not exist in the resource group."
208-
fi
209-
done
210-
211-
# If any resource exists, retry
212-
if [ "$resource_found" = true ]; then
213-
retries=$((retries + 1))
214-
if [ "$retries" -ge "$max_retries" ]; then
215-
echo "Maximum retry attempts reached. Exiting."
208+
echo "No resources found. Exiting."
216209
break
217-
else
218-
# Wait for the appropriate interval for the current retry
219-
echo "Waiting for ${retry_intervals[$retries-1]} seconds before retrying..."
220-
sleep ${retry_intervals[$retries-1]}
221210
fi
222-
else
223-
echo "No resources found. Exiting."
224-
break
225-
fi
226-
done
227-
211+
done
212+
else
213+
echo "Resource group '${{ env.RESOURCE_GROUP_NAME }}' does not exist. Skipping resource listing."
214+
fi
228215
- name: Purging the Resources
229-
if: success()
216+
if: always()
230217
run: |
231-
232218
set -e
233219
# Define variables
234220
OPENAI_COMMON_PART="-openai"
235221
openai_name="${{ env.SOLUTION_PREFIX }}${OPENAI_COMMON_PART}"
236222
echo "Azure OpenAI: $openai_name"
237-
238223
MULTISERVICE_COMMON_PART="-cogser"
239224
multiservice_account_name="${{ env.SOLUTION_PREFIX }}${MULTISERVICE_COMMON_PART}"
240225
echo "Azure MultiService Account: $multiservice_account_name"
241-
242226
# Purge OpenAI Resource
243227
echo "Purging the OpenAI Resource..."
244228
if ! az resource delete --ids /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/providers/Microsoft.CognitiveServices/locations/eastus2/resourceGroups/${{ env.RESOURCE_GROUP_NAME }}/deletedAccounts/$openai_name --verbose; then

ClientAdvisor/App/WebApp.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ COPY --from=frontend /home/node/app/static /usr/src/app/static/
3636
WORKDIR /usr/src/app
3737
EXPOSE 80
3838

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

ClientAdvisor/App/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ isort==6.0.0
2222

2323
# Testing tools
2424
pytest>=8.2,<9 # Compatible version for pytest-asyncio
25-
pytest-asyncio==0.25.3
26-
pytest-cov==6.0.0
25+
pytest-asyncio==0.24.0
26+
pytest-cov==5.0.0
2727

2828
pyodbc==5.2.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Scenarios
2020
</h2>
2121

2222

23-
### [Client Advsior](ClientAdvisor/README.md)
23+
### [Client Advisor](ClientAdvisor/README.md)
2424

2525
This copilot helps client advisors to save time and prepare relevant discussion topics for scheduled meetings. It provides an overview of daily client meetings with seamless navigation between viewing client profiles and chatting with structured data. Altogether, these features streamline meeting preparation for the advisors and result in more productive conversations with clients.
2626

ResearchAssistant/App/WebApp.Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ RUN apk add --no-cache --virtual .build-deps \
1717
openssl-dev \
1818
curl \
1919
&& apk add --no-cache \
20-
libpq \
21-
&& pip install --no-cache-dir uwsgi
20+
libpq
2221

2322
COPY ./ResearchAssistant/App/requirements.txt /usr/src/app/
24-
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt \
23+
RUN pip install --upgrade pip setuptools wheel \
24+
&& pip install --no-cache-dir -r /usr/src/app/requirements.txt \
25+
&& pip install --no-cache-dir uwsgi \
2526
&& rm -rf /root/.cache
2627

2728
COPY ./ResearchAssistant/App/ /usr/src/app/

0 commit comments

Comments
 (0)