Skip to content

Commit

Permalink
cherry-pick (#3075) to 4.7 (add .yaml-based DevOps pipelines) (#3096)
Browse files Browse the repository at this point in the history
* cherry-pick (#3075) to 4.7, fix merge conflicts
* add .yaml-based Azure DevOps pipelines to 4.8 branch
* add readableFlowing property to INodeSocket (#2515)
* fix cherry-pick 8d9a3e3

Co-authored-by: Michael Richardson <[email protected]>

* change from adaptive-expressions to botframework-expressions
* manually pick tokenResolver test fixes
 * from f1b6fc2
* address PR feedback re: INodeSocket
* remove unused internal AddressInfo interface
  • Loading branch information
stevengum authored Nov 30, 2020
1 parent 0924ce6 commit fd2990a
Show file tree
Hide file tree
Showing 6 changed files with 338 additions and 4 deletions.
50 changes: 50 additions & 0 deletions build/yaml/botbuilder-js-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# This runs under botbuilder-js-ci.yml. Runs unit tests on Node versions 10 and 12.
#

# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber)
name: $(Build.BuildId)

pool:
vmImage: 'macOS-10.15'

variables:
PackageVersion: 4.8.0-preview.$(Build.BuildNumber)
PreviewPackageVersion: 4.8.0-preview.$(Build.BuildNumber)

stages:
- stage: Node10CI
dependsOn: [] # Run this stage in parallel
displayName: 'Node 10.x CI'
variables:
NodeVersion: 10.x
jobs:
- job: Node10UnitTests
displayName: 'Node 10.x Unit Tests'
steps:
- template: js-build-steps.yml

- powershell: |
pushd ..
Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"}
displayName: 'Dir workspace except node-modules (takes 5 seconds)'
continueOnError: true
condition: succeededOrFailed()
- stage: Node12CI
dependsOn: [] # Run this stage in parallel
displayName: 'Node 12.x CI'
variables:
NodeVersion: 12.x
jobs:
- job: Node12UnitTests
displayName: 'Node 12.x Unit Tests'
steps:
- template: js-build-steps.yml

- powershell: |
pushd ..
Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"}
displayName: 'Dir workspace except node-modules (takes 5 seconds)'
continueOnError: true
condition: succeededOrFailed()
111 changes: 111 additions & 0 deletions build/yaml/botbuilder-js-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# This runs under BotBuilder-JS-daily-yaml.

# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber)
name: $(Build.BuildId)

pool:
vmImage: 'macOS-10.15'

variables:
NodeVersion: 12.x
# PackageVersion: Define this in Azure to be settable at queue time. Ex: 4.8.0-dev.{DateStamp}.{CommitHash}
# PreviewPackageVersion: Define this in Azure to be settable at queue time. Ex: 4.8.0-dev.{DateStamp}.{CommitHash}

steps:
- powershell: |
# Replace {DateStamp} and {CommitHash} tokens with the actual values in vars PackageVersion and PreviewPackageVersion
$dateStamp = (Get-Date -format "yyyyMMdd");
$commitHash = "$(Build.SourceVersion)".SubString(0,7);
"Raw PackageVersion = $(PackageVersion)";
$v = "$(PackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash);
Write-Host "##vso[task.setvariable variable=PackageVersion;]$v";
"Resolved PackageVersion = $v";
"Raw PreviewPackageVersion = $(PreviewPackageVersion)";
$ppv = "$(PreviewPackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash);
Write-Host "##vso[task.setvariable variable=PreviewPackageVersion;]$ppv";
"Resolved PreviewPackageVersion = $ppv";
displayName: 'Resolve package version variables'

- template: js-daily-build-steps.yml

- script: 'lerna exec --no-private npm pack'
displayName: 'lerna exec --no-private npm pack'

- task: CopyFiles@2
displayName: 'Copy TGZ files to staging'
inputs:
SourceFolder: libraries
Contents: '*/*.tgz'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true

- task: PublishBuildArtifacts@1
displayName: 'Publish staging to Build Artifacts'

- powershell: |
[string[]]$outvar = (Get-ChildItem *.tgz -Path $(Build.ArtifactStagingDirectory) ).Name;
[int] $packageCount = $outvar.Length;
$PackagesDescription = "$packageCount packages";
$PackagesDescription;
$outvar;
"##vso[task.setvariable variable=PackagesDescription;]$PackagesDescription";
[int] $maxTags = 5;
if ($packageCount -gt $maxTags) {
# Too many packages for tags.
# Set a few package name variables for tags
for ($i = 0; $i -lt $maxTags; $i++ ) {
$p = $outvar[$i];
"##vso[task.setvariable variable=pkg$i;]$p";
}
$message = "(See 'Package names' task log for full list)";
Write-Host "##vso[task.setvariable variable=pkg$i;]$message";
Write-Host $message;
$packageCount = ++$i;
} else {
# Set package name variables for tags
for ($i = 0; $i -lt $packageCount; $i++ ) {
$p = $outvar[$i];
"##vso[task.setvariable variable=pkg$i;]$p";
}
}
for ($i = $packageCount; $i -le 30; $i++ ) {
# Set remaining variables to an empty string
"##vso[task.setvariable variable=pkg$i;]";
}
displayName: 'Package names'
continueOnError: true

- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag Build with package names'
inputs:
tags: |
$(PACKAGESDESCRIPTION)
$(PKG0)
$(PKG1)
$(PKG2)
$(PKG3)
$(PKG4)
$(PKG5)
$(PKG6)
$(PKG7)
$(PKG8)
$(PKG9)
$(PKG10)
$(PKG11)
$(PKG12)
continueOnError: true

- powershell: |
pushd ..
ls -R
displayName: 'Dir workspace'
continueOnError: true
condition: succeededOrFailed()
85 changes: 85 additions & 0 deletions build/yaml/js-build-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#variables:
# PackageVersion: Define this in the calling pipeline.

steps:
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag Build with version number. (Skip if a fork PR to avoid access denied error.)'
inputs:
tags: |
v: $(PackageVersion)
preview v: $(PreviewPackageVersion)
continueOnError: true
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'false'))

- task: NodeTool@0
displayName: 'Use Node $(NodeVersion)'
inputs:
versionSpec: $(NodeVersion)

- task: Npm@1
displayName: 'npm install lerna ...'
inputs:
command: custom
verbose: false
customCommand: 'install --global [email protected] nyc mocha eslint-plugin-jsdoc'

- task: Npm@1
displayName: '/tools npm install'
inputs:
workingDir: tools
verbose: false

- bash: |
set -o xtrace
sed -i '' 's/${Version}/$(PackageVersion)/g' package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botframework-expressions/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-ai/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-applicationinsights/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-azure/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-core/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-dialogs/package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botbuilder-lg/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-testing/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-config/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-connector/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-schema/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-streaming/package.json
displayName: 'Replace version number in package.json files'
continueOnError: true

- bash: |
npm run update-versions
displayName: 'npm run update-versions'
env:
Version: $(PackageVersion)
PreviewPackageVersion: $(PreviewPackageVersion)

- powershell: |
$fileName = 'package-lock.json'
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName};
Write-Host "`nDeleting any files listed above";
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName} | Remove-Item -Force;
displayName: 'Delete tools/package-lock.json. Maybe avoids intermittent error in \"npm run postinstall\" ENOENT: no such file or directory, lchown ''/Users/runner/.npm/_locks/staging-7c222bec8116519f.lock'''
continueOnError: true

- task: Npm@1
displayName: 'npm run postinstall'
inputs:
command: custom
verbose: false
customCommand: 'run postinstall'

- task: Npm@1
displayName: 'npm run build'
inputs:
command: custom
verbose: false
customCommand: 'run build'

- task: Npm@1
displayName: 'npm run test'
inputs:
command: custom
verbose: false
customCommand: 'run test'
86 changes: 86 additions & 0 deletions build/yaml/js-daily-build-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#variables:
# PackageVersion: Define this in the calling pipeline.
# PreviewPackageVersion: Define this in Azure to be settable at queue time. Ex: 4.9.0-dev.{DateStamp}.{CommitHash}

steps:
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag Build with version number. (Skip if a fork PR to avoid access denied error.)'
inputs:
tags: |
v: $(PackageVersion)
preview v: $(PreviewPackageVersion)
continueOnError: true
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'false'))

- task: NodeTool@0
displayName: 'Use Node $(NodeVersion)'
inputs:
versionSpec: $(NodeVersion)

- task: Npm@1
displayName: 'npm install lerna ...'
inputs:
command: custom
verbose: false
customCommand: 'install --global [email protected] nyc mocha eslint-plugin-jsdoc'

- task: Npm@1
displayName: '/tools npm install'
inputs:
workingDir: tools
verbose: false

- bash: |
set -o xtrace
sed -i '' 's/${Version}/$(PackageVersion)/g' package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botframework-expressions/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-ai/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-applicationinsights/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-azure/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-core/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-dialogs/package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botbuilder-lg/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-testing/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-config/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-connector/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-schema/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-streaming/package.json
displayName: 'Replace version number in package.json files'
continueOnError: true

- bash: |
npm run update-versions
displayName: 'npm run update-versions'
env:
Version: $(PackageVersion)
PreviewPackageVersion: $(PreviewPackageVersion)

- powershell: |
$fileName = 'package-lock.json'
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName};
Write-Host "`nDeleting any files listed above";
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName} | Remove-Item -Force;
displayName: 'Delete tools/package-lock.json. Maybe avoids intermittent error in \"npm run postinstall\" ENOENT: no such file or directory, lchown ''/Users/runner/.npm/_locks/staging-7c222bec8116519f.lock'''
continueOnError: true

- task: Npm@1
displayName: 'npm run postinstall'
inputs:
command: custom
verbose: false
customCommand: 'run postinstall'

- task: Npm@1
displayName: 'npm run build'
inputs:
command: custom
verbose: false
customCommand: 'run build'

- task: Npm@1
displayName: 'npm run test'
inputs:
command: custom
verbose: false
customCommand: 'run test'
8 changes: 5 additions & 3 deletions libraries/botbuilder/tests/streaming/tokenResolver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ describe(`TokenResolver`, function () {
doneReject = reject;
});
const returnTokenResponse = () =>
{
doneResolve('done');
{
// Give token code 100ms to run
setTimeout(() => doneResolve('done'), 100);
return { properties: { tokenPollingSettings: { timeout: 0 } } };
};
const botLogic= (ctx) => {
Expand Down Expand Up @@ -246,7 +247,8 @@ describe(`TokenResolver`, function () {
if (i < 2) {
return { properties: { tokenPollingSettings: { interval: 100 } } };
} else {
doneResolve('done');
// Give token code 100ms to run
setTimeout(() => doneResolve('done'), 100);
return { properties: { tokenPollingSettings: { timeout: 0 } } };
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export namespace JwtTokenValidation {
await authConfig.validateClaims(claims);
} else if (SkillValidation.isSkillClaim(claims)) {
// Skill claims must be validated using AuthenticationConfiguration validateClaims
throw new AuthenticationError('Unauthorized Access. Request is not authorized. Skill Claims require validation.', StatusCodes.UNAUTHORIZED);
throw new Error('Unauthorized Access. Request is not authorized. Skill Claims require validation.');
}
}

Expand Down

0 comments on commit fd2990a

Please sign in to comment.