Skip to content

Commit db0e004

Browse files
committed
Dartlab pipeline improvements
1 parent 2f9fb8d commit db0e004

File tree

2 files changed

+117
-64
lines changed

2 files changed

+117
-64
lines changed

azure-pipelines-integration-dartlab.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ parameters:
3131
- name: sha
3232
type: string
3333
default: 'None'
34+
# Set to 'stop' if you want to keep the test machines around for investigation after test completion.
35+
- name: testMachineCleanUpStrategy
36+
displayName: Test Machine Clean Up Strategy
37+
type: string
38+
default: delete
39+
values:
40+
- delete
41+
- stop
42+
# The retention period for the test machine (expressed as <Days>:<Hours>:<Minutes>:<Seconds>)
43+
- name: testMachineRetention
44+
displayName: Test Machine Retention (format "D:H:M:S")
45+
type: string
46+
default: 1:0:0:0 # 3 days
3447

3548
variables:
3649
- name: XUNIT_LOGS
@@ -46,6 +59,8 @@ stages:
4659
name: VSIntegration
4760
displayName: VS Integration
4861
testLabPoolName: VS-Platform
62+
testMachineCleanUpStrategy: ${{parameters.testMachineCleanUpStrategy}}
63+
testMachineRetention: ${{parameters.testMachineRetention}}
4964
visualStudioBootstrapperURI: https://vsdrop.corp.microsoft.com/file/v1/$(VisualStudio.BuildUnderTest.ProductsDropName);bootstrappers/Enterprise/vs_enterprise.exe
5065
visualStudioInstallationParameters: --add Microsoft.VisualStudio.Component.NuGet --add Microsoft.VisualStudio.Component.Roslyn.Compiler --add Microsoft.Component.MSBuild --add Microsoft.NetCore.Component.Runtime.6.0 --add Microsoft.NetCore.Component.SDK --add Microsoft.Net.Component.4.7.2.TargetingPack --add Microsoft.VisualStudio.Component.Roslyn.LanguageServices --add Microsoft.VisualStudio.Component.FSharp --add Microsoft.ComponentGroup.ClickOnce.Publish --add Microsoft.NetCore.Component.DevelopmentTools --add Microsoft.VisualStudio.Component.MSODBC.SQL --add Microsoft.VisualStudio.Component.MSSQL.CMDLnUtils --add Microsoft.VisualStudio.Component.SQL.LocalDB.Runtime --add Microsoft.VisualStudio.Component.SQL.CLR --add Microsoft.VisualStudio.Component.CoreEditor --add Microsoft.VisualStudio.Workload.CoreEditor --add Microsoft.Net.Component.4.8.SDK --add Microsoft.Net.ComponentGroup.DevelopmentPrerequisites --add Microsoft.VisualStudio.Component.TypeScript.TSServer --add Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions --add Microsoft.VisualStudio.Component.JavaScript.TypeScript --add Microsoft.VisualStudio.Component.JavaScript.Diagnostics --add Microsoft.VisualStudio.Component.TextTemplating --add Component.Microsoft.VisualStudio.RazorExtension --add Microsoft.VisualStudio.Component.IISExpress --add Microsoft.VisualStudio.Component.Common.Azure.Tools --add Microsoft.Component.ClickOnce --add Microsoft.VisualStudio.Component.ManagedDesktop.Core --add Microsoft.VisualStudio.Component.SQL.SSDT --add Microsoft.VisualStudio.Component.SQL.DataSources --add Component.Microsoft.Web.LibraryManager --add Component.Microsoft.WebTools.BrowserLink.WebLivePreview --add Microsoft.VisualStudio.ComponentGroup.Web --add Microsoft.VisualStudio.Component.FSharp.WebTemplates --add Microsoft.VisualStudio.Component.DockerTools --add Microsoft.NetCore.Component.Web --add Microsoft.VisualStudio.Component.WebDeploy --add Microsoft.VisualStudio.Component.AppInsights.Tools --add Microsoft.VisualStudio.Component.Web --add Microsoft.Net.Component.4.8.TargetingPack --add Microsoft.Net.ComponentGroup.4.8.DeveloperTools --add Microsoft.VisualStudio.Component.AspNet45 --add Microsoft.VisualStudio.Component.AspNet --add Component.Microsoft.VisualStudio.Web.AzureFunctions --add Microsoft.VisualStudio.ComponentGroup.AzureFunctions --add Microsoft.VisualStudio.Component.Debugger.Snapshot --add Microsoft.VisualStudio.ComponentGroup.Web.CloudTools --add Microsoft.VisualStudio.Component.IntelliTrace.FrontEnd --add Microsoft.VisualStudio.Component.DiagnosticTools --add Microsoft.VisualStudio.Component.EntityFramework --add Microsoft.VisualStudio.Component.LiveUnitTesting --add Microsoft.VisualStudio.Component.Debugger.JustInTime --add Component.Microsoft.VisualStudio.LiveShare.2022 --add Microsoft.VisualStudio.Component.WslDebugging --add Microsoft.VisualStudio.Component.IntelliCode --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Component.ManagedDesktop.Prerequisites --add Microsoft.ComponentGroup.Blend --add Microsoft.VisualStudio.Component.DotNetModelBuilder --add Microsoft.VisualStudio.Component.FSharp.Desktop --add Microsoft.VisualStudio.Component.PortableLibrary --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.Net.Component.4.6.TargetingPack --add Microsoft.VisualStudio.Component.VSSDK --add Microsoft.VisualStudio.ComponentGroup.VisualStudioExtension.Prerequisites --add Microsoft.Component.CodeAnalysis.SDK --add Microsoft.VisualStudio.Workload.VisualStudioExtension --installPath "C:\Test\VisualStudio" --quiet --norestart --wait
5166
testExecutionJobStrategy:

eng/build.ps1

Lines changed: 102 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,17 @@ function TestUsingRunTests() {
520520
Write-Host "No VsProjectFault logs found to copy"
521521
}
522522

523+
if ($vsId) {
524+
$activityLogPath = Join-Path ${env:USERPROFILE} "AppData\Roaming\Microsoft\VisualStudio\$vsMajorVersion.0_$($vsId)$hive\ActivityLog.xml"
525+
$devenvExeConfig = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\$vsMajorVersion.0_$($vsId)$hive\devenv.exe.config"
526+
$mefErrors = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\$vsMajorVersion.0_$($vsId)$hive\ComponentModelCache\Microsoft.VisualStudio.Default.err"
527+
CopyToArtifactLogs $activityLogPath
528+
CopyToArtifactLogs $devenvExeConfig
529+
CopyToArtifactLogs $mefErrors
530+
} else {
531+
Write-Host "No Visual Studio instance found to copy logs from"
532+
}
533+
523534
if ($lspEditor) {
524535
$lspLogs = Join-Path $TempDir "VSLogs"
525536
$telemetryLog = Join-Path $TempDir "VSTelemetryLog"
@@ -541,6 +552,15 @@ function TestUsingRunTests() {
541552
}
542553
}
543554

555+
function CopyToArtifactLogs($inputPath) {
556+
if (Test-Path $inputPath) {
557+
Write-Host "Copying $inputPath to $LogDir"
558+
Copy-Item -Path $inputPath -Destination $LogDir
559+
} else {
560+
Write-Host "No log found to copy at $inputPath"
561+
}
562+
}
563+
544564
function EnablePreviewSdks() {
545565
$vsInfo = LocateVisualStudio
546566
if ($vsInfo -eq $null) {
@@ -561,92 +581,110 @@ function EnablePreviewSdks() {
561581
# deploying at build time.
562582
function Deploy-VsixViaTool() {
563583

584+
# Create a log file name for vsix installation. The vsix installer will append to this log (not overwrite)
585+
# so we can re-use the same log file for all our install operations.
586+
# VSIX installer will always write the log file to %temp% and ignores full paths.
587+
$logFileName = "VSIXInstaller-" + [guid]::NewGuid().ToString() + ".log"
588+
564589
$vsInfo = LocateVisualStudio
565590
if ($vsInfo -eq $null) {
566591
throw "Unable to locate required Visual Studio installation"
567592
}
568593

569-
$vsDir = $vsInfo.installationPath.TrimEnd("\")
570-
$vsId = $vsInfo.instanceId
571-
$vsMajorVersion = $vsInfo.installationVersion.Split('.')[0]
572-
$displayVersion = $vsInfo.catalog.productDisplayVersion
594+
try {
595+
$vsDir = $vsInfo.installationPath.TrimEnd("\")
596+
$script:vsId = $vsInfo.instanceId
597+
$script:vsMajorVersion = $vsInfo.installationVersion.Split('.')[0]
598+
$displayVersion = $vsInfo.catalog.productDisplayVersion
573599

574-
$hive = "RoslynDev"
575-
Write-Host "Using VS Instance $vsId ($displayVersion) at `"$vsDir`""
576-
$baseArgs = "/rootSuffix:$hive /quiet /shutdownprocesses"
600+
$script:hive = "RoslynDev"
577601

578-
Write-Host "Uninstalling old Roslyn VSIX"
602+
Write-Host "Using VS Instance $vsId ($displayVersion) at `"$vsDir`""
579603

580-
# Actual uninstall is failing at the moment using the uninstall options. Temporarily using
581-
# wildfire to uninstall our VSIX extensions
582-
$extDir = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\$vsMajorVersion.0_$vsid$hive"
583-
if (Test-Path $extDir) {
584-
foreach ($dir in Get-ChildItem -Directory $extDir) {
585-
$name = Split-Path -leaf $dir
586-
Write-Host "`tUninstalling $name"
587-
}
588-
Remove-Item -re -fo $extDir
589-
}
604+
# InstanceIds is required here to ensure it installs the vsixes only into the specified VS instance.
605+
# The default installer behavior without it is to install into every installed VS instance.
606+
$baseArgs = "/rootSuffix:$hive /quiet /shutdownprocesses /instanceIds:$vsId /logFile:$logFileName"
590607

591-
Write-Host "Installing all Roslyn VSIX"
608+
# Write the file location out to a variable so we can upload it later.
609+
$fullLogPath = Join-Path $env:TEMP $logFileName
592610

593-
# VSIX files need to be installed in this specific order:
594-
$orderedVsixFileNames = @(
595-
"Roslyn.Compilers.Extension.vsix",
596-
"Roslyn.VisualStudio.Setup.vsix",
597-
"Roslyn.VisualStudio.ServiceHub.Setup.x64.vsix",
598-
"Roslyn.VisualStudio.Setup.Dependencies.vsix",
599-
"ExpressionEvaluatorPackage.vsix",
600-
"Roslyn.VisualStudio.DiagnosticsWindow.vsix",
601-
"Microsoft.VisualStudio.IntegrationTest.Setup.vsix")
602-
603-
foreach ($vsixFileName in $orderedVsixFileNames) {
604-
$vsixFile = Join-Path $VSSetupDir $vsixFileName
605611
$vsixInstallerExe = Join-Path $vsDir "Common7\IDE\VSIXInstaller.exe"
606-
$fullArg = "$baseArgs $vsixFile"
607-
Write-Host "`tInstalling $vsixFileName"
608-
Exec-Command $vsixInstallerExe $fullArg
609-
}
610612

611-
# Set up registry
612-
$vsRegEdit = Join-Path (Join-Path (Join-Path $vsDir 'Common7') 'IDE') 'VsRegEdit.exe'
613+
Write-Host "Uninstalling old Roslyn VSIX"
613614

614-
# Disable roaming settings to avoid interference from the online user profile
615-
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio" RoamingEnabled string "1*System.Boolean*False"
615+
# Actual uninstall is failing at the moment using the uninstall options. Temporarily using
616+
# wildfire to uninstall our VSIX extensions
617+
$extDir = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\$vsMajorVersion.0_$vsid$hive"
618+
if (Test-Path $extDir) {
619+
foreach ($dir in Get-ChildItem -Directory $extDir) {
620+
$name = Split-Path -leaf $dir
621+
Write-Host "`tUninstalling $name"
622+
}
623+
Remove-Item -re -fo $extDir
624+
}
616625

617-
# Disable IntelliCode line completions to avoid interference with argument completion testing
618-
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" wholeLineCompletions string "0*System.Int32*2"
626+
Write-Host "Installing all Roslyn VSIX"
627+
628+
# VSIX files need to be installed in this specific order:
629+
$orderedVsixFileNames = @(
630+
"Roslyn.Compilers.Extension.vsix",
631+
"Roslyn.VisualStudio.Setup.vsix",
632+
"Roslyn.VisualStudio.ServiceHub.Setup.x64.vsix",
633+
"Roslyn.VisualStudio.Setup.Dependencies.vsix",
634+
"ExpressionEvaluatorPackage.vsix",
635+
"Roslyn.VisualStudio.DiagnosticsWindow.vsix",
636+
"Microsoft.VisualStudio.IntegrationTest.Setup.vsix")
637+
638+
foreach ($vsixFileName in $orderedVsixFileNames) {
639+
$vsixFile = Join-Path $VSSetupDir $vsixFileName
640+
$fullArg = "$baseArgs $vsixFile"
641+
Write-Host "`tInstalling $vsixFileName"
642+
Exec-Command $vsixInstallerExe $fullArg
643+
}
619644

620-
# Disable IntelliCode RepositoryAttachedModels since it requires authentication which can fail in CI
621-
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" repositoryAttachedModels string "0*System.Int32*2"
645+
# Set up registry
646+
$vsRegEdit = Join-Path (Join-Path (Join-Path $vsDir 'Common7') 'IDE') 'VsRegEdit.exe'
622647

623-
# Disable background download UI to avoid toasts
624-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Setup\BackgroundDownload" Value dword 0
648+
# Disable roaming settings to avoid interference from the online user profile
649+
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio" RoamingEnabled string "1*System.Boolean*False"
625650

626-
# Disable text spell checker to avoid spurious warnings in the error list
627-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Editor\EnableSpellChecker" Value dword 0
651+
# Disable IntelliCode line completions to avoid interference with argument completion testing
652+
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" wholeLineCompletions string "0*System.Int32*2"
628653

629-
# Run source generators automatically during integration tests.
630-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\SourceGeneratorExecutionBalanced" Value dword 0
654+
# Disable IntelliCode RepositoryAttachedModels since it requires authentication which can fail in CI
655+
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" repositoryAttachedModels string "0*System.Int32*2"
631656

632-
# Configure LSP
633-
$lspRegistryValue = [int]$lspEditor.ToBool()
634-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\LSP\Editor" Value dword $lspRegistryValue
635-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Lsp\PullDiagnostics" Value dword 1
657+
# Disable background download UI to avoid toasts
658+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Setup\BackgroundDownload" Value dword 0
636659

637-
# Disable text editor error reporting because it pops up a dialog. We want to either fail fast in our
638-
# custom handler or fail silently and continue testing.
639-
&$vsRegEdit set "$vsDir" $hive HKCU "Text Editor" "Report Exceptions" dword 0
660+
# Disable text spell checker to avoid spurious warnings in the error list
661+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Editor\EnableSpellChecker" Value dword 0
640662

641-
# Configure RemoteHostOptions.OOP64Bit for testing
642-
$oop64bitValue = [int]$oop64bit.ToBool()
643-
&$vsRegEdit set "$vsDir" $hive HKCU "Roslyn\Internal\OnOff\Features" OOP64Bit dword $oop64bitValue
663+
# Run source generators automatically during integration tests.
664+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\SourceGeneratorExecutionBalanced" Value dword 0
644665

645-
# Disable targeted notifications
646-
if ($ci) {
647-
# Currently does not work via vsregedit, so only apply this setting in CI
648-
#&$vsRegEdit set "$vsDir" $hive HKCU "RemoteSettings" TurnOffSwitch dword 1
649-
reg add hkcu\Software\Microsoft\VisualStudio\RemoteSettings /f /t REG_DWORD /v TurnOffSwitch /d 1
666+
# Configure LSP
667+
$lspRegistryValue = [int]$lspEditor.ToBool()
668+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\LSP\Editor" Value dword $lspRegistryValue
669+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Lsp\PullDiagnostics" Value dword 1
670+
671+
# Disable text editor error reporting because it pops up a dialog. We want to either fail fast in our
672+
# custom handler or fail silently and continue testing.
673+
&$vsRegEdit set "$vsDir" $hive HKCU "Text Editor" "Report Exceptions" dword 0
674+
675+
# Configure RemoteHostOptions.OOP64Bit for testing
676+
$oop64bitValue = [int]$oop64bit.ToBool()
677+
&$vsRegEdit set "$vsDir" $hive HKCU "Roslyn\Internal\OnOff\Features" OOP64Bit dword $oop64bitValue
678+
679+
# Disable targeted notifications
680+
if ($ci) {
681+
# Currently does not work via vsregedit, so only apply this setting in CI
682+
#&$vsRegEdit set "$vsDir" $hive HKCU "RemoteSettings" TurnOffSwitch dword 1
683+
reg add hkcu\Software\Microsoft\VisualStudio\RemoteSettings /f /t REG_DWORD /v TurnOffSwitch /d 1
684+
}
685+
} finally {
686+
$vsixInstallerLogs = Join-Path $TempDir $logFileName
687+
CopyToArtifactLogs $vsixInstallerLogs
650688
}
651689
}
652690

0 commit comments

Comments
 (0)