From bea4da91f4bf551a28d1aa0e4d6df511a80cd0e2 Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Tue, 29 Jun 2021 16:19:46 -0700 Subject: [PATCH 1/8] Add generator/deploy steps to js deploy steps and update parameters --- .../deployBotResources/deployBotResources.yml | 10 +++++-- .../yaml/deployBotResources/js/deploy.yml | 26 ++++++------------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/tests/functional/build/yaml/deployBotResources/deployBotResources.yml b/tests/functional/build/yaml/deployBotResources/deployBotResources.yml index f39e345b58..bcd2504288 100644 --- a/tests/functional/build/yaml/deployBotResources/deployBotResources.yml +++ b/tests/functional/build/yaml/deployBotResources/deployBotResources.yml @@ -153,7 +153,10 @@ stages: appId: $(BFCFNEMPTYBOTJSWEBAPPID) appSecret: $(BFCFNEMPTYBOTJSWEBAPPSECRET) project: - directory: 'Tests/Functional/Bots/JavaScript/Consumers/CodeFirst/SimpleHostBot' + generator: "generators/generator-bot-empty" + integration: "webapp" + name: "EmptyBotJSWebApp" + platform: "js" dependency: registry: ${{ parameters.dependenciesRegistryJSHosts }} version: ${{ parameters.dependenciesVersionJSHosts }} @@ -164,7 +167,10 @@ stages: appId: $(BFCFNEMPTYBOTJSFUNCTIONSID) appSecret: $(BFCFNEMPTYBOTJSFUNCTIONSSECRET) project: - directory: 'Tests/Functional/Bots/JavaScript/Consumers/CodeFirst/SimpleHostBot' + generator: "generators/generator-bot-empty" + integration: "functions" + name: "EmptyBotJSFunctions" + platform: "js" dependency: registry: ${{ parameters.dependenciesRegistryJSHosts }} version: ${{ parameters.dependenciesVersionJSHosts }} diff --git a/tests/functional/build/yaml/deployBotResources/js/deploy.yml b/tests/functional/build/yaml/deployBotResources/js/deploy.yml index 497994cda4..64a4283152 100644 --- a/tests/functional/build/yaml/deployBotResources/js/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/js/deploy.yml @@ -53,6 +53,8 @@ stages: dependsOn: "${{ parameters.dependsOn }}" jobs: - job: "Deploy" + variables: + SolutionDir: "$(BUILD.SOURCESDIRECTORY)/bots/" displayName: "Deploy steps" steps: # Delete Bot Resources @@ -72,24 +74,6 @@ stages: botName: "${{ bot.name }}" keyVault: "${{ parameters.keyVault }}" - # Prepare .env file, deleting all the declared skills, so it uses only the settings define in Azure - - ${{ if eq(bot.type, 'Host') }}: - - task: PowerShell@2 - displayName: 'Prepare .env file' - inputs: - targetType: inline - workingDirectory: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ bot.project.directory }}' - failOnStderr: true - script: | - $file = "./.env" - $content = Get-Content $file - $content | ForEach-Object { - $line = $_ - if ($line.Trim().Length -gt 0 -and -not $line.Trim().ToLower().StartsWith('skill_')) { - $line - } - } | Set-Content $file; - # Evaluate dependencies source and version - template: evaluateDependenciesVariables.yml parameters: @@ -97,6 +81,12 @@ stages: registry: "${{ bot.dependency.registry }}" version: "${{ bot.dependency.version }}" + # Generate bot template + - template: ../generator/deploy.yml + parameters: + project: "${{ bot.project }}" + solutiondir: "$(SOLUTIONDIR)" + # Tag BotBuilder version - template: ../common/tagBotBuilderVersion.yml parameters: From 6f0af176818245ee82cef667b61e7a11bbe8ed45 Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Tue, 29 Jun 2021 17:15:16 -0700 Subject: [PATCH 2/8] Add dir workspace step to js --- .../build/yaml/deployBotResources/js/deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/functional/build/yaml/deployBotResources/js/deploy.yml b/tests/functional/build/yaml/deployBotResources/js/deploy.yml index 64a4283152..bb267b7d30 100644 --- a/tests/functional/build/yaml/deployBotResources/js/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/js/deploy.yml @@ -206,3 +206,11 @@ stages: botGroup: "${{ parameters.resourceGroup }}" botName: "${{ bot.name }}" resourceSuffix: "${{ parameters.resourceSuffix }}" + + # Debugging output for the workspace + - script: | + cd .. + dir *.* /s + displayName: 'Dir workspace' + continueOnError: true + condition: succeededOrFailed() \ No newline at end of file From e86acb2458067414a85828a52a6eea071a020325 Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Wed, 30 Jun 2021 12:24:46 -0700 Subject: [PATCH 3/8] Replace working directory instances with solution directory var --- .../build/yaml/deployBotResources/js/deploy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/functional/build/yaml/deployBotResources/js/deploy.yml b/tests/functional/build/yaml/deployBotResources/js/deploy.yml index bb267b7d30..6a77f08321 100644 --- a/tests/functional/build/yaml/deployBotResources/js/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/js/deploy.yml @@ -101,7 +101,7 @@ stages: displayName: 'Set BotBuilder source and version' inputs: targetType: inline - workingDirectory: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ bot.project.directory }}' + workingDirectory: '$(SOLUTIONDIR)/${{ bot.project.name }}' failOnStderr: true script: | $registry = "$(DEPENDENCIESSOURCE)"; @@ -130,7 +130,7 @@ stages: displayName: 'Install dependencies' inputs: command: 'install' - workingDir: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ bot.project.directory }}' + workingDir: '$(SOLUTIONDIR)/${{ bot.project.name }}' customRegistries: 'useNpmrc' verbose: true @@ -141,13 +141,13 @@ stages: azureSubscription: "${{ parameters.azureSubscription }}" scriptType: pscore scriptLocation: inlineScript - inlineScript: 'az bot prepare-deploy --code-dir "${{ bot.project.directory }}" --lang Javascript' + inlineScript: 'az bot prepare-deploy --code-dir "$(SOLUTIONDIR)/${{ bot.project.name }}" --lang Javascript' # Zip bot - task: ArchiveFiles@2 displayName: 'Zip bot' inputs: - rootFolderOrFile: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/${{ bot.project.directory }}' + rootFolderOrFile: '$(SOLUTIONDIR)/${{ bot.project.name }}' includeRootFolder: false archiveType: 'zip' archiveFile: '$(SYSTEM.DEFAULTWORKINGDIRECTORY)/build/${{ bot.name }}.zip' From 2301b5f4c863c39d454258b785aed10a6839991f Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Wed, 30 Jun 2021 13:46:55 -0700 Subject: [PATCH 4/8] Remove skillv3 refs from deploy steps --- .../dotnet/evaluateDependenciesVariables.yml | 5 ----- .../deployBotResources/js/evaluateDependenciesVariables.yml | 5 ----- 2 files changed, 10 deletions(-) diff --git a/tests/functional/build/yaml/deployBotResources/dotnet/evaluateDependenciesVariables.yml b/tests/functional/build/yaml/deployBotResources/dotnet/evaluateDependenciesVariables.yml index f2e44169c4..e1fb2c57a8 100644 --- a/tests/functional/build/yaml/deployBotResources/dotnet/evaluateDependenciesVariables.yml +++ b/tests/functional/build/yaml/deployBotResources/dotnet/evaluateDependenciesVariables.yml @@ -19,20 +19,17 @@ steps: failOnStderr: true script: | # Get Source - $sourceDotNetv3MyGet = "https://botbuilder.myget.org/F/botbuilder-v3-dotnet-daily/api/v3/index.json" $sourceDotNetArtifacts = "https://pkgs.dev.azure.com/ConversationalAI/BotFramework/_packaging/SDK/nuget/v3/index.json" $sourceDotNetMyGet = "https://botbuilder.myget.org/F/botbuilder-v4-dotnet-daily/api/v3/index.json" switch -regex ("${{ parameters.registry }}") { "^($null|)$" { switch ("${{ parameters.botType }}") { - "SkillV3" { $source = $sourceDotNetv3MyGet } default { $source = $sourceDotNetArtifacts } } } "Artifacts" { $source = $sourceDotNetArtifacts } "MyGet" { switch ("${{ parameters.botType }}") { - "SkillV3" { $source = $sourceDotNetv3MyGet } default { $source = $sourceDotNetMyGet } } } @@ -53,8 +50,6 @@ steps: if ("${{ parameters.botType }}" -in "Host", "Skill") { $PackageList = nuget list Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime -Source "$source" -PreRelease $versionNumber = $PackageList.Split(" ")[-1] - } elseif ("${{ parameters.botType }}" -in "SkillV3") { - $versionNumber = "" } } STABLE { $versionNumber = "" } diff --git a/tests/functional/build/yaml/deployBotResources/js/evaluateDependenciesVariables.yml b/tests/functional/build/yaml/deployBotResources/js/evaluateDependenciesVariables.yml index fc47b0302e..67dc8ef7a7 100644 --- a/tests/functional/build/yaml/deployBotResources/js/evaluateDependenciesVariables.yml +++ b/tests/functional/build/yaml/deployBotResources/js/evaluateDependenciesVariables.yml @@ -20,12 +20,10 @@ steps: script: | # Get Source $sourceJSMyGet = "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/" - $sourceJSv3MyGet = "https://botbuilder.myget.org/F/botbuilder-v3-js-daily/npm/" $sourceJSNpm = "https://registry.npmjs.com/" switch -regex ("${{ parameters.registry }}") { "^($null|MyGet)$" { switch ("${{ parameters.botType }}") { - "SkillV3" { $source = $sourceJSv3MyGet } default { $source = $sourceJSMyGet } } } @@ -55,9 +53,6 @@ steps: if ("${{ parameters.botType }}" -in "Host", "Skill") { $PackageList = npm show botbuilder@* version | Out-String; } - elseif ("${{ parameters.botType }}" -in "SkillV3") { - $PackageList = npm show botbuilder@3.* version | Out-String; - } $versionNumber = ($PackageList.Split(" ")[-1]).Trim().TrimStart("'").TrimEnd("'"); } default { $versionNumber = "${{ parameters.version }}" } From d195636186b17db6b19c311d534e4d85736f071a Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Wed, 30 Jun 2021 13:50:59 -0700 Subject: [PATCH 5/8] Add step to remove web.config from generated bot --- .../build/yaml/deployBotResources/js/deploy.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/functional/build/yaml/deployBotResources/js/deploy.yml b/tests/functional/build/yaml/deployBotResources/js/deploy.yml index 6a77f08321..35807d2bb5 100644 --- a/tests/functional/build/yaml/deployBotResources/js/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/js/deploy.yml @@ -134,7 +134,17 @@ stages: customRegistries: 'useNpmrc' verbose: true - # Prepate bot + # Remove web.config generated from template to be able to run "az bot prepare-deploy" + - task: PowerShell@2 + displayName: 'Remove web.config' + inputs: + targetType: inline + workingDirectory: '$(SOLUTIONDIR)/${{ bot.project.name }}' + failOnStderr: true + script: | + Remove-Item .\web.config + + # Prepare bot - task: AzureCLI@2 displayName: 'Prepare Bot' inputs: From 35ae0b64c295dc334d24efd42867a50b98cbc514 Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Wed, 30 Jun 2021 14:10:36 -0700 Subject: [PATCH 6/8] only remove web.config for js webapp --- .../yaml/deployBotResources/js/deploy.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/functional/build/yaml/deployBotResources/js/deploy.yml b/tests/functional/build/yaml/deployBotResources/js/deploy.yml index 35807d2bb5..07fd5c7151 100644 --- a/tests/functional/build/yaml/deployBotResources/js/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/js/deploy.yml @@ -134,15 +134,16 @@ stages: customRegistries: 'useNpmrc' verbose: true - # Remove web.config generated from template to be able to run "az bot prepare-deploy" - - task: PowerShell@2 - displayName: 'Remove web.config' - inputs: - targetType: inline - workingDirectory: '$(SOLUTIONDIR)/${{ bot.project.name }}' - failOnStderr: true - script: | - Remove-Item .\web.config + # Remove web.config generated from webapp template to be able to run "az bot prepare-deploy" + - ${{ if eq(bot.project.integration, 'webapp') }}: + - task: PowerShell@2 + displayName: 'Remove web.config' + inputs: + targetType: inline + workingDirectory: '$(SOLUTIONDIR)/${{ bot.project.name }}' + failOnStderr: true + script: | + Remove-Item .\web.config # Prepare bot - task: AzureCLI@2 From 41c380e9b3f05a0e757f618bcafdbfe1c18a495e Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Thu, 1 Jul 2021 10:32:43 -0700 Subject: [PATCH 7/8] Rename /bots directory to /workspace --- .../build/yaml/deployBotResources/dotnet/deploy.yml | 2 +- .../build/yaml/deployBotResources/generator/deploy.yml | 6 +++--- .../functional/build/yaml/deployBotResources/js/deploy.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/functional/build/yaml/deployBotResources/dotnet/deploy.yml b/tests/functional/build/yaml/deployBotResources/dotnet/deploy.yml index f3d0c6f054..d7084aa0ad 100644 --- a/tests/functional/build/yaml/deployBotResources/dotnet/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/dotnet/deploy.yml @@ -55,7 +55,7 @@ stages: jobs: - job: "Deploy" variables: - SolutionDir: "$(BUILD.SOURCESDIRECTORY)/bots/" + SolutionDir: "$(BUILD.SOURCESDIRECTORY)/workspace/" displayName: "Deploy steps" steps: # Delete Bot Resources diff --git a/tests/functional/build/yaml/deployBotResources/generator/deploy.yml b/tests/functional/build/yaml/deployBotResources/generator/deploy.yml index f7c1680fde..97dda50331 100644 --- a/tests/functional/build/yaml/deployBotResources/generator/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/generator/deploy.yml @@ -8,10 +8,10 @@ parameters: type: string steps: - # Create /bots directory + # Create /workspace directory - script: | - mkdir bots - displayName: 'Create bots directory' + mkdir workspace + displayName: 'Create workspace directory' # Install yarn workspace - script: | diff --git a/tests/functional/build/yaml/deployBotResources/js/deploy.yml b/tests/functional/build/yaml/deployBotResources/js/deploy.yml index 07fd5c7151..a8994dc8b8 100644 --- a/tests/functional/build/yaml/deployBotResources/js/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/js/deploy.yml @@ -54,7 +54,7 @@ stages: jobs: - job: "Deploy" variables: - SolutionDir: "$(BUILD.SOURCESDIRECTORY)/bots/" + SolutionDir: "$(BUILD.SOURCESDIRECTORY)/workspace/" displayName: "Deploy steps" steps: # Delete Bot Resources From b95c5832859d38e338ad4d98052899c0119cf4fa Mon Sep 17 00:00:00 2001 From: Ryan Lengel Isgrig Date: Thu, 1 Jul 2021 10:56:36 -0700 Subject: [PATCH 8/8] fix comment --- .../build/yaml/deployBotResources/generator/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/build/yaml/deployBotResources/generator/deploy.yml b/tests/functional/build/yaml/deployBotResources/generator/deploy.yml index 97dda50331..a061e1677f 100644 --- a/tests/functional/build/yaml/deployBotResources/generator/deploy.yml +++ b/tests/functional/build/yaml/deployBotResources/generator/deploy.yml @@ -8,7 +8,7 @@ parameters: type: string steps: - # Create /workspace directory + # Create /workspace - script: | mkdir workspace displayName: 'Create workspace directory'