Set up slack key vault linkage (#3478)

This commit is contained in:
BruceHaley 2020-03-02 17:11:19 -08:00 коммит произвёл GitHub
Родитель 3e4871fcab
Коммит b14269bf81
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 29 добавлений и 30 удалений

Просмотреть файл

@ -133,34 +133,34 @@ namespace Microsoft.Bot.Builder.FunctionalTests
{
if (string.IsNullOrWhiteSpace(_slackChannel) || string.IsNullOrWhiteSpace(_slackBotToken) || string.IsNullOrWhiteSpace(_slackClientSigningSecret) || string.IsNullOrWhiteSpace(_slackVerificationToken) || string.IsNullOrWhiteSpace(_botName))
{
_slackChannel = Environment.GetEnvironmentVariable("SLACK_CHANNEL");
_slackChannel = Environment.GetEnvironmentVariable("SlackChannel");
if (string.IsNullOrWhiteSpace(_slackChannel))
{
Assert.Inconclusive("Environment variable 'SLACK_CHANNEL' not found.");
Assert.Inconclusive("Environment variable 'SlackChannel' not found.");
}
_slackBotToken = Environment.GetEnvironmentVariable("SLACK_BOT_TOKEN");
_slackBotToken = Environment.GetEnvironmentVariable("SlackBotToken");
if (string.IsNullOrWhiteSpace(_slackBotToken))
{
Assert.Inconclusive("Environment variable 'SLACK_BOT_TOKEN' not found.");
Assert.Inconclusive("Environment variable 'SlackBotToken' not found.");
}
_slackClientSigningSecret = Environment.GetEnvironmentVariable("SLACK_CLIENT_SIGNING_SECRET");
_slackClientSigningSecret = Environment.GetEnvironmentVariable("SlackClientSigningSecret");
if (string.IsNullOrWhiteSpace(_slackClientSigningSecret))
{
Assert.Inconclusive("Environment variable 'SLACK_CLIENT_SIGNING_SECRET' not found.");
Assert.Inconclusive("Environment variable 'SlackClientSigningSecret' not found.");
}
_slackVerificationToken = Environment.GetEnvironmentVariable("SLACK_VERIFICATION_TOKEN");
_slackVerificationToken = Environment.GetEnvironmentVariable("SlackVerificationToken");
if (string.IsNullOrWhiteSpace(_slackVerificationToken))
{
Assert.Inconclusive("Environment variable 'SLACK_VERIFICATION_TOKEN' not found.");
Assert.Inconclusive("Environment variable 'SlackVerificationToken' not found.");
}
_botName = Environment.GetEnvironmentVariable("BOT_NAME");
_botName = Environment.GetEnvironmentVariable("BotName");
if (string.IsNullOrWhiteSpace(_botName))
{
Assert.Inconclusive("Environment variable 'BOT_NAME' not found.");
Assert.Inconclusive("Environment variable 'BotName' not found.");
}
}
}

Просмотреть файл

@ -13,17 +13,15 @@ variables:
BuildConfiguration: 'debug'
BuildPlatform: 'any cpu'
Parameters.solution: Microsoft.Bot.Builder.sln
# AppId: define this in Azure
# AppSecret: define this in Azure
# AzureSubscription: define this in Azure
# BotGroup: define this in Azure
# BotName: define this in Azure
# FacebookAccessToken: define this in Azure
# FacebookAppSecret: define this in Azure
# SlackVerificationToken: define this in Azure
# SlackBotToken: define this in Azure
# SlackClientSigningSecret: define this in Azure
# SlackChannel: define this in Azure
# SlackTestBotAppId: define this in Azure
# SlackTestBotAppSecret: define this in Azure
# SlackTestBotBotGroup: define this in Azure
# SlackTestBotBotName: define this in Azure
# SlackTestBotSlackBotToken: define this in Azure
# SlackTestBotSlackChannel: define this in Azure
# SlackTestBotSlackClientSigningSecret: define this in Azure
# SlackTestBotSlackVerificationToken: define this in Azure
steps:
- template: ci-build-steps.yml
@ -37,6 +35,17 @@ steps:
arguments: '--output $(System.DefaultWorkingDirectory)\tests\Adapters\Microsoft.Bot.Builder.Adapters.Slack.TestBot\PublishedBot'
modifyOutputPath: false
- powershell: |
echo '##vso[task.setvariable variable=AppId]$(SlackTestBotAppId)'
echo '##vso[task.setvariable variable=AppSecret]$(SlackTestBotAppSecret)'
echo '##vso[task.setvariable variable=BotGroup]$(SlackTestBotBotGroup)'
echo '##vso[task.setvariable variable=BotName]$(SlackTestBotBotName)'
echo '##vso[task.setvariable variable=SlackBotToken]$(SlackTestBotSlackBotToken)'
echo '##vso[task.setvariable variable=SlackChannel]$(SlackTestBotSlackChannel)'
echo '##vso[task.setvariable variable=SlackClientSigningSecret]$(SlackTestBotSlackClientSigningSecret)'
echo '##vso[task.setvariable variable=SlackVerificationToken]$(SlackTestBotSlackVerificationToken)'
displayName: 'Set Environment Variables'
- task: AzureCLI@1
displayName: 'Create Resources'
inputs:
@ -46,16 +55,6 @@ steps:
call az deployment create --name "$(BotGroup)" --template-file "$(System.DefaultWorkingDirectory)\tests\Adapters\Microsoft.Bot.Builder.Adapters.Slack.TestBot\DeploymentTemplates\template-with-new-rg.json" --location "westus" --parameters appId=$(AppId) appSecret="$(AppSecret)" botId="$(BotName)" botSku=F0 newAppServicePlanName="$(BotName)" newWebAppName="$(BotName)" groupName="$(BotGroup)" groupLocation="westus" newAppServicePlanLocation="westus" slackVerificationToken="$(SlackVerificationToken)" slackBotToken="$(SlackBotToken)" slackClientSigningSecret="$(SlackClientSigningSecret)"
call az webapp deployment source config-zip --resource-group "$(BotGroup)" --name "$(BotName)" --src "$(System.DefaultWorkingDirectory)\tests\Adapters\Microsoft.Bot.Builder.Adapters.Slack.TestBot\PublishedBot\PublishedBot.zip"
- powershell: |
echo '##vso[task.setvariable variable=SLACK_CHANNEL]$(SlackChannel)'
echo '##vso[task.setvariable variable=SLACK_BOT_TOKEN]$(SlackBotToken)'
echo '##vso[task.setvariable variable=SLACK_CLIENT_SIGNING_SECRET]$(SlackClientSigningSecret)'
echo '##vso[task.setvariable variable=SLACK_VERIFICATION_TOKEN]$(SlackVerificationToken)'
echo '##vso[task.setvariable variable=BOT_NAME]$(BotName)'
echo '##vso[task.setvariable variable=TESTAPPID]$(AppId)'
echo '##vso[task.setvariable variable=TESTPASSWORD]$(AppSecret)'
displayName: 'Set Environment Variables'
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs: