Move to BYOC queues

- aspnet/AspNetCore-Internal#2033
- use conditions matching aspnet/Extensions and dotnet/Arcade
  - e.g. 05cb24592a/azure-pipelines.yml (L49-L54)
- install necessary Build Tools for Visual Studio 2019 components and workloads on CI
- revert part of 85ae18c723 because multiple editions of VS 2019 are now publicly available
  - that is, restore support for multiple editions in InstallVisualStudio.ps1
- update InstallVisualStudio.ps1 to
  - support BuildTools edition of VS 2019

nit: merge a couple of Windows build steps
  - support automatically updating latest version of a VS edition  on the machine
  - include `-Quiet` option for a completely non-interactive installation
This commit is contained in:
Doug Bunting 2019-03-20 20:58:55 -07:00
parent 1f63f25508
commit 5fa1c241ec
No known key found for this signature in database
GPG Key ID: 4F7A35FC67E693A9
3 changed files with 99 additions and 43 deletions

View File

@ -6,7 +6,9 @@
# jobDisplayName: string
# The friendly job name to display in the UI. Defaults to the name of the OS.
# poolName: string
# The name of the VSTS agent queue to use.
# The name of the Azure DevOps agent pool to use.
# poolVmImage: string
# The name of a virtual machine image to use. Primarily of interest when using the Hosted pools.
# agentOs: string
# Used in templates to define variables which are OS specific. Typically from the set { Windows, Linux, macOS }
# buildArgs: string
@ -47,6 +49,7 @@
parameters:
agentOs: 'Windows'
poolName: ''
poolVmImage: ''
buildArgs: ''
configuration: 'Release'
beforeBuild: []
@ -91,10 +94,12 @@ jobs:
${{ if ne(parameters.poolName, '') }}:
name: ${{ parameters.poolName }}
${{ if and(eq(parameters.poolName, ''), eq(parameters.agentOs, 'Windows')) }}:
${{ if eq(variables['System.TeamProject'], 'internal') }}:
name: dotnet-internal-vs2019-preview
${{ if ne(variables['System.TeamProject'], 'internal') }}:
name: dotnet-external-vs2019-preview
${{ if or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}:
name: NetCorePublic-Int-Pool
queue: BuildPool.Windows.10.Amd64.VS2019.BT.Open
${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
name: NetCoreInternal-Int-Pool
queue: BuildPool.Windows.10.Amd64.VS2019.BT
variables:
AgentOsName: ${{ parameters.agentOs }}
ASPNETCORE_TEST_LOG_MAXPATH: "200" # Keep test log file name length low enough for artifact zipping
@ -115,20 +120,25 @@ jobs:
steps:
- checkout: self
clean: true
- ${{ if eq(parameters.agentOs, 'Windows') }}:
- powershell: ./eng/scripts/InstallVisualStudio.ps1 -Edition BuildTools -Quiet
displayName: Install Build Tools for Visual Studio 2019
- ${{ if eq(parameters.installNodeJs, 'true') }}:
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- ${{ if and(eq(parameters.installJdk, 'true'), eq(parameters.agentOs, 'Windows')) }}:
- powershell: ./eng/scripts/InstallJdk.ps1 '11.0.1'
- powershell: |
./eng/scripts/InstallJdk.ps1 '11.0.1'
Write-Host "##vso[task.prependpath]$env:JAVA_HOME\bin"
displayName: Install JDK 11
- powershell: Write-Host "##vso[task.prependpath]$env:JAVA_HOME\bin"
displayName: Prepend JAVA bin folder to the PATH.
- powershell: Write-Host "##vso[task.setvariable variable=SeleniumProcessTrackingFolder]$(BuildDirectory)\obj\selenium\"
displayName: Add Selenium process tracking folder environment variable
- powershell: ./eng/scripts/InstallGoogleChrome.ps1
displayName: Install chrome
- powershell: |
Write-Host "##vso[task.setvariable variable=SeleniumProcessTrackingFolder]$(BuildDirectory)\obj\selenium\"
./eng/scripts/InstallGoogleChrome.ps1
displayName: Install Chrome
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.agentOs, 'Windows'), eq(parameters.codeSign, 'true')) }}:
- task: MicroBuildSigningPlugin@1
displayName: Install MicroBuild Signing plugin

View File

@ -3,46 +3,40 @@
Installs or updates Visual Studio on a local developer machine.
.DESCRIPTION
This installs Visual Studio along with all the workloads required to contribute to this repository.
.PARAMETER Edition
Selects which 'offering' of Visual Studio to install. Must be one of these values:
BuildTools
Community
Professional
Enterprise (the default)
.PARAMETER InstallPath
The location of Visual Studio
The location on disk where Visual Studio should be installed or updated. Default path is location of latest
existing installation of the specified edition, if any. If that VS edition is not currently installed, default
path is '${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\`$Edition".
.PARAMETER Passive
Run the installer without requiring interaction.
.PARAMETER Quiet
Run the installer without UI and wait for installation to complete.
.LINK
https://visualstudio.com
https://github.com/aspnet/AspNetCore/blob/master/docs/BuildFromSource.md
.EXAMPLE
To install VS 2019 Preview, run this command in PowerShell:
To install VS 2019 Enterprise, run this command in PowerShell:
.\InstallVisualStudio.ps1
#>
[CmdletBinding(DefaultParameterSetName = 'Default')]
param(
# TODO - once VS 2019 16.0 RTM is released, make this a parameter again
# .PARAMETER Edition
# Must be one of these values:
# Community
# Professional
# Enterprise
# Selects which 'offering' of Visual Studio to install.
# [ValidateSet('Community', 'Professional', 'Enterprise')]
# [string]$Edition,
[ValidateSet('BuildTools','Community', 'Professional', 'Enterprise')]
[string]$Edition = 'Enterprise',
[string]$InstallPath,
[switch]$Passive
[switch]$Passive,
[switch]$Quiet
)
# VS previews are only available publicly as 'Enterprise' versions. They should be available to the community to use without a paid license.
$Edition = 'Enterprise'
if (-not $Edition) {
Write-Host "You must specify a value for the -Edition parameter which selects the kind of Visual Studio to install." -f Red
if ($Passive -and $Quiet) {
Write-Host "The -Passive and -Quiet options cannot be used together." -f Red
Write-Host "Run ``Get-Help $PSCommandPath`` for more details." -f Red
Write-Host ""
Write-Host "Example: ./InstallVisualStudio -Edition Community" -f Red
Write-Host ""
exit 1
}
@ -54,35 +48,57 @@ mkdir $intermedateDir -ErrorAction Ignore | Out-Null
$bootstrapper = "$intermedateDir\vsinstaller.exe"
$ProgressPreference = 'SilentlyContinue' # Workaround PowerShell/PowerShell#2138
Invoke-WebRequest -Uri "https://aka.ms/vs/16/pre/vs_$($Edition.ToLowerInvariant()).exe" -OutFile $bootstrapper
Invoke-WebRequest -Uri "https://aka.ms/vs/16/release/vs_$($Edition.ToLowerInvariant()).exe" -OutFile $bootstrapper
$productId = "Microsoft.VisualStudio.Product.$Edition"
if (-not $InstallPath) {
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vsWhere)
{
$InstallPath = &$vsWhere -version '[16,17)' -latest -prerelease -products $productId -property installationPath
}
}
if (-not $InstallPath) {
# $InstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\$Edition"
$InstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Preview"
$InstallPath = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\$Edition"
}
# no backslashes - this breaks the installer
$InstallPath = $InstallPath.TrimEnd('\')
[string[]] $arguments = @()
if (Test-path $InstallPath) {
$arguments += 'modify'
}
$responseFile = "$PSScriptRoot\vs.json"
if ("$Edition" -eq "BuildTools") {
$responseFile = "$PSScriptRoot\vs.buildtools.json"
}
$arguments += `
'--productId', "Microsoft.VisualStudio.Product.$Edition", `
'--productId', $productId, `
'--installPath', "`"$InstallPath`"", `
'--in', "$PSScriptRoot\vs.json", `
'--in', "`"$responseFile`"", `
'--norestart'
if ($Passive) {
$arguments += '--passive'
}
if ($Quiet) {
$arguments += '--quiet', '--wait'
}
Write-Host ""
Write-Host "Installing Visual Studio 2019 $Edition" -f Magenta
Write-Host ""
Write-Host "Running '$bootstrapper $arguments'"
& $bootstrapper @arguments
$process = Start-Process -FilePath "$bootstrapper" -ArgumentList $arguments `
-PassThru -RedirectStandardError "$intermedateDir\errors.txt" -Verbose -Wait
if ($process.ExitCode -ne 0) {
Get-Content "$intermedateDir\errors.txt" | Write-Error
}
Remove-Item "$intermedateDir\errors.txt" -errorAction SilentlyContinue
exit $process.ExitCode

View File

@ -0,0 +1,30 @@
{
"channelUri": "https://aka.ms/vs/16/pre/channel",
"channelId": "VisualStudio.16.Preview",
"includeRecommended": false,
"addProductLang": [
"en-US"
],
"add": [
"Microsoft.Net.Component.4.6.1.TargetingPack",
"Microsoft.Net.Component.4.6.2.TargetingPack",
"Microsoft.Net.Component.4.7.1.TargetingPack",
"Microsoft.Net.Component.4.7.2.SDK",
"Microsoft.Net.Component.4.7.2.TargetingPack",
"Microsoft.Net.Component.4.7.TargetingPack",
"Microsoft.VisualStudio.Component.FSharp.MSBuild",
"Microsoft.VisualStudio.Component.NuGet",
"Microsoft.VisualStudio.Component.NuGet.BuildTools",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.v141.ATL",
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK.17134",
"Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools",
"Microsoft.VisualStudio.Workload.MSBuildTools",
"Microsoft.VisualStudio.Workload.NetCoreBuildTools",
"Microsoft.VisualStudio.Workload.VCTools",
"Microsoft.VisualStudio.Workload.VisualStudioExtensionBuildTools",
"Microsoft.VisualStudio.Workload.WebBuildTools"
]
}