Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 19 additions & 32 deletions .github/workflows/CAdeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
- dev
- demo
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'fix-deploy' branch mentioned in the PR description is not included in the branch list. Consider adding it if deployments should trigger for that branch as well.

Suggested change
- demo
- demo
- fix-deploy

Copilot uses AI. Check for mistakes.
schedule:
- cron: '0 6,18 * * *' # Runs at 6:00 AM and 6:00 PM GMT

Expand Down Expand Up @@ -51,8 +53,8 @@ jobs:
export AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}"
export AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}"
export AZURE_SUBSCRIPTION_ID="${{ secrets.AZURE_SUBSCRIPTION_ID }}"
export GPT_MIN_CAPACITY="150"
export TEXT_EMBEDDING_MIN_CAPACITY="80"
export GPT_MIN_CAPACITY="${{ env.GPT_MIN_CAPACITY }}"
export TEXT_EMBEDDING_MIN_CAPACITY="${{ env.TEXT_EMBEDDING_MIN_CAPACITY }}"
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TEXT_EMBEDDING_MIN_CAPACITY environment variable is referenced but never defined in the workflow. This will result in empty values being passed to the deployment script.

Copilot uses AI. Check for mistakes.
export AZURE_REGIONS="${{ vars.AZURE_REGIONS_CA }}"
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GPT_MIN_CAPACITY and TEXT_EMBEDDING_MIN_CAPACITY environment variables are referenced but never defined in the workflow. This will result in empty values being passed to the deployment script.

Suggested change
export AZURE_REGIONS="${{ vars.AZURE_REGIONS_CA }}"
export AZURE_REGIONS="${{ vars.AZURE_REGIONS_CA }}"
# Validate environment variables
if [ -z "${GPT_MIN_CAPACITY}" ] || [ -z "${TEXT_EMBEDDING_MIN_CAPACITY}" ]; then
echo "Error: GPT_MIN_CAPACITY or TEXT_EMBEDDING_MIN_CAPACITY is not set." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
chmod +x infra/scripts/checkquota.sh
if ! infra/scripts/checkquota.sh; then
Expand All @@ -70,7 +72,7 @@ jobs:
-H "Content-Type: application/json" \
-d '{
"subject": "CA Deployment - Quota Check Failed",
"body": "<p>The quota check failed for CA deployment.</p><p><a href=\"'${RUN_URL}'\">View run</a></p>"
"body": "<p>Dear Team,</p><p>We would like to inform you that the Build-your-own-copilot-Solution-Accelerator(Client Advisor) Deployment Automation process has encountered a quota issue. Hence, unable to proceed with the deployment.</p><p><a href=\"'${RUN_URL}'\">View run</a></p>"
}'

- name: Fail on Quota Check
Expand Down Expand Up @@ -132,10 +134,11 @@ jobs:
if [[ "$BRANCH" == "main" ]]; then TAG="latest"
elif [[ "$BRANCH" == "dev" ]]; then TAG="dev"
elif [[ "$BRANCH" == "demo" ]]; then TAG="demo"
else TAG="default"; fi
echo "tagname=$TAG" >> $GITHUB_OUTPUT
else TAG="latest"; fi
echo "IMAGE_TAG=$TAG" >> $GITHUB_ENV
echo "Image Tag: $TAG"

- name: Get Deployment Output and extract Values
- name: Deploy and extract values from deployment output
id: get_output
run: |
set -e
Expand All @@ -146,7 +149,7 @@ jobs:
DEPLOY_OUTPUT=$(az deployment group create \
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \
--template-file infra/main.bicep \
--parameters aiDeploymentsLocation=${{ env.AZURE_LOCATION }} environmentName=${{ env.SOLUTION_PREFIX }} cosmosLocation=westus gptDeploymentCapacity=${{ env.GPT_MIN_CAPACITY }} embeddingDeploymentCapacity=${{ env.TEXT_EMBEDDING_MIN_CAPACITY }} \
--parameters aiDeploymentsLocation=${{ env.AZURE_LOCATION }} environmentName=${{ env.SOLUTION_PREFIX }} cosmosLocation=westus gptDeploymentCapacity=${{ env.GPT_MIN_CAPACITY }} embeddingDeploymentCapacity=${{ env.TEXT_EMBEDDING_MIN_CAPACITY }} imageTag=${{ env.IMAGE_TAG }} \
--query "properties.outputs" -o json)


Expand Down Expand Up @@ -179,64 +182,48 @@ jobs:
echo "CLIENT_NAME=$CLIENT_NAME" >> $GITHUB_ENV
export RG_NAME=$(echo "$DEPLOY_OUTPUT" | jq -r '.resourcE_GROUP_NAME.value')
echo "RG_NAME=$RG_NAME" >> $GITHUB_ENV
export RESOURCE_GROUP_NAME_FOUNDRY=$(echo "$DEPLOY_OUTPUT" | jq -r '.resourcE_GROUP_NAME_FOUNDRY.value')
echo "RESOURCE_GROUP_NAME_FOUNDRY=$RESOURCE_GROUP_NAME_FOUNDRY" >> $GITHUB_ENV
WEBAPP_URL=$(echo $DEPLOY_OUTPUT | jq -r '.weB_APP_URL.value')
echo "WEBAPP_URL=$WEBAPP_URL" >> $GITHUB_OUTPUT
WEB_APP_NAME=$(echo $DEPLOY_OUTPUT | jq -r '.weB_APP_NAME.value')
echo "WEB_APP_NAME=$WEB_APP_NAME" >> $GITHUB_ENV
echo "Deployment output: $DEPLOY_OUTPUT"


echo "🔧 Disabling AUTH_ENABLED for the web app..."
az webapp config appsettings set -g "$RG_NAME" -n "$WEB_APP_NAME" --settings AUTH_ENABLED=false

sleep 30

export CLIENT_OBJECT_ID=$(az identity show \
--name "$CLIENT_NAME" \
--resource-group "$RG_NAME" \
--query 'principalId' -o tsv)
echo "CLIENT_OBJECT_ID=$CLIENT_OBJECT_ID" >> $GITHUB_ENV



- name: Deploy Infra and Import Sample Data
run: |
set -e
az account set --subscription "${{ secrets.AZURE_SUBSCRIPTION_ID }}"

export AZURE_CLIENT_OBJECT_ID=$(az ad sp show --id ${{ secrets.AZURE_CLIENT_ID }} --query id -o tsv)
echo "AZURE_CLIENT_OBJECT_ID=$AZURE_CLIENT_OBJECT_ID" >> $GITHUB_ENV

az role assignment create \
--assignee-object-id $AZURE_CLIENT_OBJECT_ID \
--assignee-principal-type ServicePrincipal \
--role "Cognitive Services OpenAI User" \
--scope /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.RG_NAME }}/providers/Microsoft.CognitiveServices/accounts/${{ env.AI_FOUNDARY_NAME }}

sleep 30

az role assignment create \
--assignee-object-id $AZURE_CLIENT_OBJECT_ID \
--assignee-principal-type ServicePrincipal \
--role "Search Index Data Contributor" \
--scope /subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/${{ env.RG_NAME }}/providers/Microsoft.Search/searchServices/${{ env.SEARCH_SERVICE_NAME }}

echo "Running post-deployment script..."

bash ./infra/scripts/add_cosmosdb_access.sh \
"${{ env.RG_NAME }}" \
"${{ env.COSMOS_DB_ACCOUNT_NAME }}" \
"${{ secrets.AZURE_CLIENT_ID }}"

bash ./infra/scripts/copy_kb_files.sh \
"${{ env.STORAGE_ACCOUNT }}" \
"${{ env.STORAGE_CONTAINER }}" \
"" \
"${{ secrets.AZURE_CLIENT_ID }}"

bash ./infra/scripts/run_create_index_scripts.sh \
"${{ env.KEYVAULT_NAME }}" \
"" \
"${{ secrets.AZURE_CLIENT_ID }}" \
"${{ env.RG_NAME }}" \
"${{ env.SQL_SERVER }}"
"${{ env.SQL_SERVER }}" \
"${{ env.AI_FOUNDARY_NAME }}" \
"${{ env.SEARCH_SERVICE_NAME }}" \
"${{ env.RESOURCE_GROUP_NAME_FOUNDRY }}"


user_roles_json='[
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/test_automation.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
name: Test Automation ClientAdvisor

on:
push:
branches:
- main
- dev

paths:
- 'tests/e2e-test/**'
schedule:
- cron: '0 13 * * *' # Runs at 1 PM UTC
workflow_dispatch:

workflow_call:
inputs:
CA_WEB_URL:
required: true
type: string
secrets:
EMAILNOTIFICATION_LOGICAPP_URL_TA:
required: false
description: "Logic App URL for email notifications"

env:
url: ${{ inputs.CA_WEB_URL }}
Expand Down