Skip to content

Commit

Permalink
Merge pull request #2 from aaronba/syncbranch
Browse files Browse the repository at this point in the history
Updates from micrsoft/chat-copilot community changes
  • Loading branch information
mattahearn authored Mar 26, 2024
2 parents f0e53f8 + e77008a commit 4aa3c2a
Show file tree
Hide file tree
Showing 76 changed files with 1,968 additions and 3,075 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/copilot-build-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ jobs:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
uses: gittools/actions/gitversion/setup@v1
with:
versionSpec: "5.x"

- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
uses: gittools/actions/gitversion/execute@v1

- name: Set version tag
id: versiontag
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/copilot-build-memorypipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ jobs:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
uses: gittools/actions/gitversion/setup@v1
with:
versionSpec: "5.x"

- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
uses: gittools/actions/gitversion/execute@v1

- name: Set version tag
id: versiontag
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/copilot-build-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ jobs:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
uses: gittools/actions/gitversion/setup@v1
with:
versionSpec: "5.x"

- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
uses: gittools/actions/gitversion/execute@v1

- name: Set version tag
id: versiontag
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/copilot-deploy-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ on:
DEPLOYMENT_NAME:
required: true
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true
outputs:
backend-host:
description: "Host to which backend is deployed"
Expand Down Expand Up @@ -57,11 +50,11 @@ jobs:
working-directory: "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}"

- name: Azure login
uses: azure/login@v1
uses: azure/login@v2
with:
client-id: ${{secrets.AZURE_CLIENT_ID}}
tenant-id: ${{secrets.AZURE_TENANT_ID}}
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
client-id: ${{vars.AZURE_GITHUB_ACCESS_APP_ID}}
tenant-id: ${{vars.AZURE_GITHUB_ACCESS_TENANT_ID}}
subscription-id: ${{vars.AZURE_GITHUB_ACCESS_SUB_ID}}
enable-AzPSSession: false

- name: Get app name
Expand All @@ -72,12 +65,12 @@ jobs:
echo "backend-host=$WEB_APP_NAME" >> $GITHUB_OUTPUT
- name: Enable Run From Package
uses: azure/CLI@v1
uses: azure/CLI@v2
with:
azcliversion: 2.30.0
inlineScript: |
az webapp config appsettings set --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --name ${{ env.AZURE_WEBAPP_NAME }} --settings WEBSITE_RUN_FROM_PACKAGE="1" -o none
- name: "Deploy"
run: |
scripts/deploy/deploy-webapi.sh -p "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}/webapi.zip" -d ${{inputs.DEPLOYMENT_NAME}} -s ${{secrets.AZURE_SUBSCRIPTION_ID}} -rg ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --skip-app-registration
scripts/deploy/deploy-webapi.sh -p "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}/webapi.zip" -d ${{inputs.DEPLOYMENT_NAME}} -s ${{vars.AZURE_SUBSCRIPTION_ID}} -rg ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --skip-app-registration
26 changes: 0 additions & 26 deletions .github/workflows/copilot-deploy-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ on:
PLUGINS_ARTIFACT_NAME:
required: true
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true
AZURE_OPENAI_ENDPOINT:
required: true
outputs:
backend-host:
description: "Host on which backend runs"
Expand All @@ -38,11 +29,6 @@ jobs:
uses: ./.github/workflows/copilot-deploy-infra.yml
with:
ENVIRONMENT: ${{inputs.ENVIRONMENT}}
secrets:
AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}}
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}
AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}}

deploy-backend:
needs: [deploy-infra]
Expand All @@ -51,10 +37,6 @@ jobs:
ARTIFACT_NAME: ${{inputs.WEBAPI_ARTIFACT_NAME}}
DEPLOYMENT_NAME: ${{needs.deploy-infra.outputs.deployment-id}}
ENVIRONMENT: ${{inputs.ENVIRONMENT}}
secrets:
AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}}
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}

deploy-memorypipeline:
needs: [deploy-infra]
Expand All @@ -63,10 +45,6 @@ jobs:
ARTIFACT_NAME: ${{inputs.MEMORYPIPELINE_ARTIFACT_NAME}}
DEPLOYMENT_NAME: ${{needs.deploy-infra.outputs.deployment-id}}
ENVIRONMENT: ${{inputs.ENVIRONMENT}}
secrets:
AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}}
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}

deploy-plugins:
needs: [deploy-infra]
Expand All @@ -75,7 +53,3 @@ jobs:
ARTIFACT_NAME: ${{inputs.PLUGINS_ARTIFACT_NAME}}
DEPLOYMENT_NAME: ${{needs.deploy-infra.outputs.deployment-id}}
ENVIRONMENT: ${{inputs.ENVIRONMENT}}
secrets:
AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}}
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}
24 changes: 7 additions & 17 deletions .github/workflows/copilot-deploy-infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,6 @@ on:
ENVIRONMENT:
required: true
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true
AZURE_OPENAI_ENDPOINT:
required: true
outputs:
deployment-id:
description: "The Id of the current deployment."
Expand Down Expand Up @@ -45,20 +36,19 @@ jobs:
clean: true

- name: Azure login
uses: azure/login@v1
uses: azure/login@v2
with:
client-id: ${{secrets.AZURE_CLIENT_ID}}
tenant-id: ${{secrets.AZURE_TENANT_ID}}
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
client-id: ${{vars.AZURE_GITHUB_ACCESS_APP_ID}}
tenant-id: ${{vars.AZURE_GITHUB_ACCESS_TENANT_ID}}
subscription-id: ${{vars.AZURE_GITHUB_ACCESS_SUB_ID}}
enable-AzPSSession: false

- name: deploy-infra
uses: azure/CLI@v1
uses: azure/CLI@v2
with:
azcliversion: 2.30.0
inlineScript: |
AI_SERVICE_KEY=$(az cognitiveservices account keys list --name ${{vars.AZUREOPENAI__NAME}} --resource-group ${{vars.AZUREOPENAI_DEPLOYMENT_GROUP_NAME}} | jq -r '.key1')
AI_SERVICE_KEY=$(az cognitiveservices account keys list --name ${{vars.AZURE_OPENAI_NAME}} --resource-group ${{vars.AZUREOPENAI_DEPLOYMENT_GROUP_NAME}} | jq -r '.key1')
echo "::add-mask::$AI_SERVICE_KEY"
APP_TENANT_ID=${{vars.APPLICATION_TENANT_ID}}
[ -z "$APP_TENANT_ID" ] && APP_TENANT_ID=${{secrets.AZURE_TENANT_ID}} # Use secrets.AZURE_TENANT_ID if vars.APPLICATION_TENANT_ID is not set
scripts/deploy/deploy-azure.sh --subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{steps.deployment-id.outputs.deployment_name}} --region ${{vars.CC_DEPLOYMENT_REGION}} --client-id ${{vars.BACKEND_CLIENT_ID}} --frontend-client-id ${{vars.APPLICATION_CLIENT_ID}} --tenant-id $APP_TENANT_ID --instance ${{vars.AZURE_INSTANCE}} --ai-service AzureOpenAI --ai-endpoint ${{secrets.AZURE_OPENAI_ENDPOINT}} --ai-service-key $AI_SERVICE_KEY --app-service-sku ${{vars.WEBAPP_API_SKU}} --no-deploy-package --debug-deployment --deploy-web-searcher-plugin
scripts/deploy/deploy-azure.sh --subscription ${{vars.AZURE_SUBSCRIPTION_ID}} --resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} --deployment-name ${{steps.deployment-id.outputs.deployment_name}} --region ${{vars.CC_DEPLOYMENT_REGION}} --client-id ${{vars.BACKEND_CLIENT_ID}} --frontend-client-id ${{vars.APPLICATION_CLIENT_ID}} --tenant-id $APP_TENANT_ID --instance ${{vars.AZURE_INSTANCE}} --ai-service AzureOpenAI --ai-endpoint ${{vars.AZURE_OPENAI_ENDPOINT}} --ai-service-key $AI_SERVICE_KEY --app-service-sku ${{vars.WEBAPP_API_SKU}} --no-deploy-package --debug-deployment --deploy-web-searcher-plugin
17 changes: 5 additions & 12 deletions .github/workflows/copilot-deploy-memorypipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ on:
DEPLOYMENT_NAME:
required: true
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true

permissions:
contents: read
Expand Down Expand Up @@ -49,11 +42,11 @@ jobs:
working-directory: "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}"

- name: Azure login
uses: azure/login@v1
uses: azure/login@v2
with:
client-id: ${{secrets.AZURE_CLIENT_ID}}
tenant-id: ${{secrets.AZURE_TENANT_ID}}
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
client-id: ${{vars.AZURE_GITHUB_ACCESS_APP_ID}}
tenant-id: ${{vars.AZURE_GITHUB_ACCESS_TENANT_ID}}
subscription-id: ${{vars.AZURE_GITHUB_ACCESS_SUB_ID}}
enable-AzPSSession: false

- name: Get app name
Expand All @@ -62,7 +55,7 @@ jobs:
echo "AZURE_WEBAPP_NAME=$WEB_APP_NAME" >> $GITHUB_ENV
- name: Enable Run From Package
uses: azure/CLI@v1
uses: azure/CLI@v2
with:
azcliversion: 2.30.0
inlineScript: |
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/copilot-deploy-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,13 @@ jobs:
WEBAPI_ARTIFACT_NAME: ${{needs.build-webapi.outputs.artifact}}
MEMORYPIPELINE_ARTIFACT_NAME: ${{needs.build-memorypipeline.outputs.artifact}}
PLUGINS_ARTIFACT_NAME: ${{needs.build-plugins.outputs.artifact}}
secrets:
AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}}
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}
AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}}

int-tests:
uses: ./.github/workflows/copilot-run-integration-tests.yml
needs: int
with:
BACKEND_HOST: ${{needs.int.outputs.backend-host}}
ENVIRONMENT: int

stable:
needs: [int-tests, build-webapi, build-memorypipeline, build-plugins]
Expand All @@ -51,8 +47,3 @@ jobs:
WEBAPI_ARTIFACT_NAME: ${{needs.build-webapi.outputs.artifact}}
MEMORYPIPELINE_ARTIFACT_NAME: ${{needs.build-memorypipeline.outputs.artifact}}
PLUGINS_ARTIFACT_NAME: ${{needs.build-plugins.outputs.artifact}}
secrets:
AZURE_CLIENT_ID: ${{secrets.AZURE_CLIENT_ID}}
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}
AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}}
17 changes: 5 additions & 12 deletions .github/workflows/copilot-deploy-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ on:
DEPLOYMENT_NAME:
required: true
type: string
secrets:
AZURE_CLIENT_ID:
required: true
AZURE_TENANT_ID:
required: true
AZURE_SUBSCRIPTION_ID:
required: true

permissions:
contents: read
Expand Down Expand Up @@ -54,17 +47,17 @@ jobs:
working-directory: "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}"

- name: "Azure login"
uses: azure/login@v1
uses: azure/login@v2
with:
client-id: ${{secrets.AZURE_CLIENT_ID}}
tenant-id: ${{secrets.AZURE_TENANT_ID}}
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
client-id: ${{vars.AZURE_GITHUB_ACCESS_APP_ID}}
tenant-id: ${{vars.AZURE_GITHUB_ACCESS_TENANT_ID}}
subscription-id: ${{vars.AZURE_GITHUB_ACCESS_SUB_ID}}
enable-AzPSSession: false

- name: "Deploy"
run: |
scripts/deploy/deploy-plugins.sh \
--deployment-name ${{inputs.DEPLOYMENT_NAME}} \
--subscription ${{secrets.AZURE_SUBSCRIPTION_ID}} \
--subscription ${{vars.AZURE_SUBSCRIPTION_ID}} \
--resource-group ${{vars.CC_DEPLOYMENT_GROUP_NAME}} \
--packages "${{ github.workspace }}/${{inputs.ARTIFACT_NAME}}"
24 changes: 14 additions & 10 deletions .github/workflows/copilot-run-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,24 @@ on:
BACKEND_HOST:
required: true
type: string
ENVIRONMENT:
required: true
type: string
workflow_call:
inputs:
BACKEND_HOST:
required: true
type: string
ENVIRONMENT:
required: true
type: string

permissions:
contents: read

jobs:
tests:
environment: ${{inputs.ENVIRONMENT}}
name: Integration Testing
runs-on: windows-latest

Expand All @@ -26,18 +33,15 @@ jobs:
- name: Configure test environment
working-directory: integration-tests
env:
TenantId: ${{ secrets.COPILOT_CHAT_TEST_TENANT_ID }}
WebApiClientId: ${{ secrets.COPILOT_CHAT_TEST_APP_AAD_WEBAPI_CLIENT_ID }}
WebAppClientId: ${{ secrets.COPILOT_CHAT_TEST_APP_AAD_WEBAPP_CLIENT_ID }}
Username: ${{secrets.COPILOT_CHAT_TEST_USER_ACCOUNT1}}
Password: ${{secrets.COPILOT_CHAT_TEST_USER_PASSWORD1}}
TestUsername: ${{secrets.COPILOT_CHAT_TEST_USER_ACCOUNT1}}
TestPassword: ${{secrets.COPILOT_CHAT_TEST_USER_PASSWORD1}}
run: |
dotnet user-secrets set "BaseServerUrl" "https://${{inputs.BACKEND_HOST}}.azurewebsites.net/"
dotnet user-secrets set "Authority" "https://login.microsoftonline.com/$env:TenantID"
dotnet user-secrets set "ClientID" "$env:WebAppClientId"
dotnet user-secrets set "Scopes" "openid, offline_access, profile, api://$env:WebApiClientId/access_as_user"
dotnet user-secrets set "Username" "$env:Username"
dotnet user-secrets set "Password" "$env:Password"
dotnet user-secrets set "Authority" "https://login.microsoftonline.com/${{vars.APPLICATION_TENANT_ID}}"
dotnet user-secrets set "ClientID" ${{vars.APPLICATION_CLIENT_ID}}
dotnet user-secrets set "Scopes" "openid, offline_access, profile, api://${{vars.BACKEND_CLIENT_ID}}/access_as_user"
# dotnet user-secrets set "TestUsername" "$env:TestUsername"
# dotnet user-secrets set "TestPassword" "$env:TestPassword"
- name: Run integration tests
run: dotnet test --logger trx
19 changes: 10 additions & 9 deletions .github/workflows/copilot-test-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Copilot Chat Tests
on:
workflow_dispatch:
inputs:
ENVIRONMENT:
required: true
type: string
merge_group:
types: [checks_requested]

Expand All @@ -9,6 +13,7 @@ permissions:

jobs:
e2e:
environment: ${{inputs.ENVIRONMENT}}
defaults:
run:
working-directory: webapp
Expand Down Expand Up @@ -37,20 +42,16 @@ jobs:
working-directory: webapi
env:
AzureOpenAI__ApiKey: ${{ secrets.AZUREOPENAI__APIKEY }}
AzureOpenAI__Endpoint: ${{ secrets.AZUREOPENAI__ENDPOINT }}
TenantId: ${{ secrets.COPILOT_CHAT_TEST_TENANT_ID }}
WebApi_ClientId: ${{ secrets.COPILOT_CHAT_TEST_APP_AAD_WEBAPI_CLIENT_ID }}
WebApp_ClientId: ${{ secrets.COPILOT_CHAT_TEST_APP_AAD_WEBAPP_CLIENT_ID }}
run: |
dotnet dev-certs https
dotnet user-secrets set "KernelMemory:Services:AzureOpenAIText:APIKey" "$AzureOpenAI__ApiKey"
dotnet user-secrets set "KernelMemory:Services:AzureOpenAIText:Endpoint" "$AzureOpenAI__Endpoint"
dotnet user-secrets set "KernelMemory:Services:AzureOpenAIText:Endpoint" ${{vars.AZURE_OPENAI_ENDPOINT}}
dotnet user-secrets set "KernelMemory:Services:AzureOpenAIEmbedding:APIKey" "$AzureOpenAI__ApiKey"
dotnet user-secrets set "KernelMemory:Services:AzureOpenAIEmbedding:Endpoint" "$AzureOpenAI__Endpoint"
dotnet user-secrets set "KernelMemory:Services:AzureOpenAIEmbedding:Endpoint" ${{vars.AZURE_OPENAI_ENDPOINT}}
dotnet user-secrets set "Authentication:Type" "AzureAd"
dotnet user-secrets set "Authentication:AzureAd:TenantId" "$TenantId"
dotnet user-secrets set "Authentication:AzureAd:ClientId" "$WebApi_ClientId"
dotnet user-secrets set "Frontend:AadClientId" "$WebApp_ClientId"
dotnet user-secrets set "Authentication:AzureAd:TenantId" ${{vars.APPLICATION_TENANT_ID}}
dotnet user-secrets set "Authentication:AzureAd:ClientId" ${{vars.BACKEND_CLIENT_ID}}
dotnet user-secrets set "Frontend:AadClientId" ${{vars.APPLICATION_CLIENT_ID}}
- name: Start service in background
working-directory: webapi
Expand Down
Loading

0 comments on commit 4aa3c2a

Please sign in to comment.