Fix syntax errors in the e2e test build definition

This commit is contained in:
Nate McMaster 2018-08-29 21:15:19 -07:00
parent f6fc60a0ed
commit 7dc68e6f91
No known key found for this signature in database
GPG Key ID: C6F361EAE0EB4089
2 changed files with 78 additions and 64 deletions

View File

@ -1,25 +1,19 @@
phases: trigger: none
- phase: Windows queue:
queue: name: DotNetCore-Windows
name: DotNetCore-Windows timeoutInMinutes: 120
timeoutInMinutes: 120 steps:
variables: - task: NodeTool@0
CI: true displayName: Install Node 10.x
steps: inputs:
- task: NodeTool@0 versionSpec: 10.x
displayName: Install Node 10.x - powershell: |
inputs: test/Cli.FunctionalTests/run-tests.ps1 -ci -ProdConManifestUrl $env:ProdConManifestUrl
versionSpec: 10.x condition: ne(variables['PB_SkipTests'], 'true')
- powershell: < displayName: Run E2E tests
test/Cli.FunctionalTests/run-tests.ps1 - task: PublishTestResults@2
-AssetRootUrl $(PB_AssetRootUrl) displayName: Publish test results
-RestoreSources $(PB_RestoreSource) condition: always()
-PackageVersionsFile $(PB_PackageVersionPropsUrl) inputs:
condition: ne(variables['PB_SKipTests'], 'true') testRunner: vstest
displayName: Run e2e tests testResultsFiles: 'artifacts/logs/**/*.trx'
- task: PublishTestResults@2
displayName: Publish test results
condition: always()
inputs:
testRunner: vstest
testResultsFiles: 'artifacts/logs/**/*.trx'

View File

@ -2,23 +2,32 @@
.SYNOPSIS .SYNOPSIS
This script runs the tests in this project on complete build of the .NET Core CLI This script runs the tests in this project on complete build of the .NET Core CLI
.PARAMETER ci
This is a CI build
.PARAMETER AccessTokenSuffix
The access token for Azure blobs
.PARAMETER AssetRootUrl .PARAMETER AssetRootUrl
The blob feed for the .NET Core CLI The blob feed for the .NET Core CLI. If not specified, it will determined automatically if possible.
.PARAMETER RestoreSources .PARAMETER RestoreSources
A list of additional NuGet feeds A list of additional NuGet feeds. If not specified, it will determined automatically if possible.
.PARAMETER SdkVersion .PARAMETER ProdConManifestUrl
The version of the .NET Core CLI to test. If not specified, the version will be determined automatically if possible. The prodcon build.xml file
.PARAMETER PackageVersionsFile .PARAMETER ProcConChannel
A URL or filepath to a list of package versions The prodcon channel to use if a build.xml file isn't set.
#> #>
param( param(
$AssetRootUrl = 'https://dotnetcli.blob.core.windows.net/dotnet', [switch]$ci,
$RestoreSources = 'https://dotnet.myget.org/F/dotnet-core/api/v3/index.json', $AssetRootUrl = $env:PB_AccessRootUrl,
$SdkVersion = $null, $AccessTokenSuffix = $env:PB_AccessTokenSuffix,
$PackageVersionsFile = $null $RestoreSources = $env:PB_RestoreSources,
$ProdConManifestUrl,
$ProcConChannel = 'release/2.2'
) )
$ErrorActionPreference = 'Stop' $ErrorActionPreference = 'Stop'
@ -27,41 +36,53 @@ Set-StrictMode -Version 1
$repoRoot = Resolve-Path "$PSScriptRoot/../../" $repoRoot = Resolve-Path "$PSScriptRoot/../../"
Import-Module "$repoRoot/scripts/common.psm1" -Scope Local -Force Import-Module "$repoRoot/scripts/common.psm1" -Scope Local -Force
$AssetRootUrl = $AssetRootUrl.TrimEnd('/')
Push-Location $PSScriptRoot Push-Location $PSScriptRoot
try { try {
New-Item -Type Directory "$PSScriptRoot/obj/" -ErrorAction Ignore | Out-Null New-Item -Type Directory "$PSScriptRoot/obj/" -ErrorAction Ignore | Out-Null
$sdkVersion = ''
$pkgPropsFile = $PackageVersionsFile if (-not $ci -or $ProdConManifestUrl) {
if ($PackageVersionsFile -like 'http*') {
$pkgPropsFile = "$PSScriptRoot/obj/packageversions.props" if (-not $ProdConManifestUrl) {
Remove-Item $pkgPropsFile -ErrorAction Ignore Write-Host -ForegroundColor Magenta "Running tests for the latest ProdCon build"
Invoke-WebRequest -UseBasicParsing $PackageVersionsFile -OutFile $pkgPropsFile $ProdConManifestUrl = "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/product/cli/$ProcConChannel/build.xml"
}
[xml] $prodConManifest = Invoke-RestMethod $ProdConManifestUrl
$RestoreSources = $prodConManifest.OrchestratedBuild.Endpoint `
| ? { $_.Type -eq 'BlobFeed' } `
| select -first 1 -ExpandProperty Url
$AssetRootUrl = $RestoreSources -replace '/index.json', '/assets'
$sdkVersion = $prodConManifest.OrchestratedBuild.Build `
| ? { $_.Name -eq 'cli' } `
| select -first 1 -ExpandProperty ProductVersion
}
else {
if (-not $AssetRootUrl) {
Write-Error "Missing required parameter: AssetRootUrl"
}
$AssetRootUrl = $AssetRootUrl.TrimEnd('/')
[xml] $cli = Invoke-RestMethod "$AssetRootUrl/orchestration-metadata/manifests/cli.xml${AccessTokenSuffix}"
$sdkVersion = $cli.Build.ProductVersion
} }
if (-not $SdkVersion) { Write-Host "sdkVersion: $sdkVersion"
$cliManifestUrl = "$AssetRootUrl/orchestration-metadata/manifests/cli.xml" Write-Host "AssetRootUrl: $AssetRootUrl"
Write-Host "No SDK version was specified. Attempting to determine the version from $cliManifestUrl" Write-Host "RestoreSources: $RestoreSources"
$cliXml = "$PSScriptRoot/obj/cli.xml"
Remove-Item $cliXml -ErrorAction Ignore
Invoke-WebRequest -UseBasicParsing $cliManifestUrl -OutFile $cliXml
[xml] $cli = Get-Content $cliXml
$SdkVersion = $cli.Build.ProductVersion
}
Write-Host "SDK: $SdkVersion" @{ sdk = @{ version = $sdkVersion } } | ConvertTo-Json | Set-Content "$PSScriptRoot/global.json"
@{ sdk = @{ version = $SdkVersion } } | ConvertTo-Json | Set-Content "$PSScriptRoot/global.json"
$dotnetRoot = "$repoRoot/.dotnet" $dotnetRoot = "$repoRoot/.dotnet"
$dotnet = "$dotnetRoot/dotnet.exe" $dotnet = "$dotnetRoot/dotnet.exe"
if (-not (Test-Path "$dotnetRoot/sdk/$SdkVersion/dotnet.dll")) { if (-not (Test-Path "$dotnetRoot/sdk/$sdkVersion/dotnet.dll")) {
Remote-Item -Recurse -Force $dotnetRoot -ErrorAction Ignore | Out-Null Remove-Item -Recurse -Force $dotnetRoot -ErrorAction Ignore | Out-Null
$cliUrl = "$AssetRootUrl/Sdk/$SdkVersion/dotnet-sdk-$SdkVersion-win-x64.zip" $cliUrl = "$AssetRootUrl/Sdk/$sdkVersion/dotnet-sdk-$sdkVersion-win-x64.zip"
Write-Host "Downloading $cliUrl" Write-Host "Downloading $cliUrl"
Invoke-WebRequest -UseBasicParsing $cliUrl -OutFile "$PSScriptRoot/obj/dotnet.zip" Invoke-WebRequest -UseBasicParsing "${cliUrl}${AccessTokenSuffix}" -OutFile "$PSScriptRoot/obj/dotnet.zip"
Expand-Archive "$PSScriptRoot/obj/dotnet.zip" -DestinationPath $dotnetRoot Expand-Archive "$PSScriptRoot/obj/dotnet.zip" -DestinationPath $dotnetRoot
} }
@ -70,14 +91,13 @@ try {
$env:DOTNET_MULTILEVEL_LOOKUP = 0 $env:DOTNET_MULTILEVEL_LOOKUP = 0
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 0 $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 0
$env:MSBuildSdksPath = '' $env:MSBuildSdksPath = ''
$env:PATH="$dotnetRoot;$env:PATH" $env:PATH = "$dotnetRoot;$env:PATH"
Invoke-Block { & $dotnet test ` Invoke-Block { & $dotnet test `
--logger "console;verbosity=detailed" ` --logger "console;verbosity=detailed" `
--logger "trx;LogFile=$repoRoot/artifacts/logs/e2etests.trx" ` --logger "trx;LogFileName=$repoRoot/artifacts/logs/e2etests.trx" `
"-p:DotNetRestoreSources=$RestoreSources" ` "-p:DotNetRestoreSources=$RestoreSources" `
"-p:DotNetPackageVersionPropsPath=$pkgPropsFile" ` "-bl:$repoRoot/artifacts/logs/e2etests.binlog" }
"-bl:$repoRoot/artifacts/logs/e2etests.binlog" }
} }
finally { finally {
Pop-Location Pop-Location