Skip to content

Commit 0c384bb

Browse files
committed
Dartlab pipeline improvements
1 parent 1fea447 commit 0c384bb

File tree

2 files changed

+114
-64
lines changed

2 files changed

+114
-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: 99 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,96 +552,120 @@ 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
# Deploy our core VSIX libraries to Visual Studio via the Roslyn VSIX tool. This is an alternative to
545565
# deploying at build time.
546566
function Deploy-VsixViaTool() {
547567

568+
# Create a log file name for vsix installation. The vsix installer will append to this log (not overwrite)
569+
# so we can re-use the same log file for all our install operations.
570+
# VSIX installer will always write the log file to %temp% and ignores full paths.
571+
$logFileName = "VSIXInstaller-" + [guid]::NewGuid().ToString() + ".log"
572+
548573
$vsInfo = LocateVisualStudio
549574
if ($vsInfo -eq $null) {
550575
throw "Unable to locate required Visual Studio installation"
551576
}
552577

553-
$vsDir = $vsInfo.installationPath.TrimEnd("\")
554-
$vsId = $vsInfo.instanceId
555-
$vsMajorVersion = $vsInfo.installationVersion.Split('.')[0]
556-
$displayVersion = $vsInfo.catalog.productDisplayVersion
578+
try {
579+
$vsDir = $vsInfo.installationPath.TrimEnd("\")
580+
$script:vsId = $vsInfo.instanceId
581+
$script:vsMajorVersion = $vsInfo.installationVersion.Split('.')[0]
582+
$displayVersion = $vsInfo.catalog.productDisplayVersion
557583

558-
$hive = "RoslynDev"
559-
Write-Host "Using VS Instance $vsId ($displayVersion) at `"$vsDir`""
560-
$baseArgs = "/rootSuffix:$hive /quiet /shutdownprocesses"
584+
$script:hive = "RoslynDev"
561585

562-
Write-Host "Uninstalling old Roslyn VSIX"
586+
Write-Host "Using VS Instance $vsId ($displayVersion) at `"$vsDir`""
563587

564-
# Actual uninstall is failing at the moment using the uninstall options. Temporarily using
565-
# wildfire to uninstall our VSIX extensions
566-
$extDir = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\$vsMajorVersion.0_$vsid$hive"
567-
if (Test-Path $extDir) {
568-
foreach ($dir in Get-ChildItem -Directory $extDir) {
569-
$name = Split-Path -leaf $dir
570-
Write-Host "`tUninstalling $name"
571-
}
572-
Remove-Item -re -fo $extDir
573-
}
588+
# InstanceIds is required here to ensure it installs the vsixes only into the specified VS instance.
589+
# The default installer behavior without it is to install into every installed VS instance.
590+
$baseArgs = "/rootSuffix:$hive /quiet /shutdownprocesses /instanceIds:$vsId /logFile:$logFileName"
574591

575-
Write-Host "Installing all Roslyn VSIX"
592+
$vsixInstallerExe = Join-Path $vsDir "Common7\IDE\VSIXInstaller.exe"
576593

577-
# VSIX files need to be installed in this specific order:
578-
$orderedVsixFileNames = @(
579-
"Roslyn.Compilers.Extension.vsix",
580-
"Roslyn.VisualStudio.Setup.vsix",
581-
"Roslyn.VisualStudio.ServiceHub.Setup.x64.vsix",
582-
"Roslyn.VisualStudio.Setup.Dependencies.vsix",
583-
"ExpressionEvaluatorPackage.vsix",
584-
"Roslyn.VisualStudio.DiagnosticsWindow.vsix",
585-
"Microsoft.VisualStudio.IntegrationTest.Setup.vsix")
594+
Write-Host "Uninstalling old Roslyn VSIX"
586595

587-
foreach ($vsixFileName in $orderedVsixFileNames) {
588-
$vsixFile = Join-Path $VSSetupDir $vsixFileName
589-
$vsixInstallerExe = Join-Path $vsDir "Common7\IDE\VSIXInstaller.exe"
590-
$fullArg = "$baseArgs $vsixFile"
591-
Write-Host "`tInstalling $vsixFileName"
592-
Exec-Command $vsixInstallerExe $fullArg
593-
}
596+
# Actual uninstall is failing at the moment using the uninstall options. Temporarily using
597+
# wildfire to uninstall our VSIX extensions
598+
$extDir = Join-Path ${env:USERPROFILE} "AppData\Local\Microsoft\VisualStudio\$vsMajorVersion.0_$vsid$hive"
599+
if (Test-Path $extDir) {
600+
foreach ($dir in Get-ChildItem -Directory $extDir) {
601+
$name = Split-Path -leaf $dir
602+
Write-Host "`tUninstalling $name"
603+
}
604+
Remove-Item -re -fo $extDir
605+
}
594606

595-
# Set up registry
596-
$vsRegEdit = Join-Path (Join-Path (Join-Path $vsDir 'Common7') 'IDE') 'VsRegEdit.exe'
607+
Write-Host "Installing all Roslyn VSIX"
608+
609+
# VSIX files need to be installed in this specific order:
610+
$orderedVsixFileNames = @(
611+
"Roslyn.Compilers.Extension.vsix",
612+
"Roslyn.VisualStudio.Setup.vsix",
613+
"Roslyn.VisualStudio.ServiceHub.Setup.x64.vsix",
614+
"Roslyn.VisualStudio.Setup.Dependencies.vsix",
615+
"ExpressionEvaluatorPackage.vsix",
616+
"Roslyn.VisualStudio.DiagnosticsWindow.vsix",
617+
"Microsoft.VisualStudio.IntegrationTest.Setup.vsix")
618+
619+
foreach ($vsixFileName in $orderedVsixFileNames) {
620+
$vsixFile = Join-Path $VSSetupDir $vsixFileName
621+
$fullArg = "$baseArgs $vsixFile"
622+
Write-Host "`tInstalling $vsixFileName"
623+
Exec-Command $vsixInstallerExe $fullArg
624+
}
597625

598-
# Disable roaming settings to avoid interference from the online user profile
599-
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio" RoamingEnabled string "1*System.Boolean*False"
626+
# Set up registry
627+
$vsRegEdit = Join-Path (Join-Path (Join-Path $vsDir 'Common7') 'IDE') 'VsRegEdit.exe'
600628

601-
# Disable IntelliCode line completions to avoid interference with argument completion testing
602-
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" wholeLineCompletions string "0*System.Int32*2"
629+
# Disable roaming settings to avoid interference from the online user profile
630+
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio" RoamingEnabled string "1*System.Boolean*False"
603631

604-
# Disable IntelliCode RepositoryAttachedModels since it requires authentication which can fail in CI
605-
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" repositoryAttachedModels string "0*System.Int32*2"
632+
# Disable IntelliCode line completions to avoid interference with argument completion testing
633+
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" wholeLineCompletions string "0*System.Int32*2"
606634

607-
# Disable background download UI to avoid toasts
608-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Setup\BackgroundDownload" Value dword 0
635+
# Disable IntelliCode RepositoryAttachedModels since it requires authentication which can fail in CI
636+
&$vsRegEdit set "$vsDir" $hive HKCU "ApplicationPrivateSettings\Microsoft\VisualStudio\IntelliCode" repositoryAttachedModels string "0*System.Int32*2"
609637

610-
# Disable text spell checker to avoid spurious warnings in the error list
611-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Editor\EnableSpellChecker" Value dword 0
638+
# Disable background download UI to avoid toasts
639+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Setup\BackgroundDownload" Value dword 0
612640

613-
# Run source generators automatically during integration tests.
614-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\SourceGeneratorExecutionBalanced" Value dword 0
641+
# Disable text spell checker to avoid spurious warnings in the error list
642+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Editor\EnableSpellChecker" Value dword 0
615643

616-
# Configure LSP
617-
$lspRegistryValue = [int]$lspEditor.ToBool()
618-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\LSP\Editor" Value dword $lspRegistryValue
619-
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Lsp\PullDiagnostics" Value dword 1
644+
# Run source generators automatically during integration tests.
645+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\SourceGeneratorExecutionBalanced" Value dword 0
620646

621-
# Disable text editor error reporting because it pops up a dialog. We want to either fail fast in our
622-
# custom handler or fail silently and continue testing.
623-
&$vsRegEdit set "$vsDir" $hive HKCU "Text Editor" "Report Exceptions" dword 0
647+
# Configure LSP
648+
$lspRegistryValue = [int]$lspEditor.ToBool()
649+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Roslyn\LSP\Editor" Value dword $lspRegistryValue
650+
&$vsRegEdit set "$vsDir" $hive HKCU "FeatureFlags\Lsp\PullDiagnostics" Value dword 1
624651

625-
# Configure RemoteHostOptions.OOP64Bit for testing
626-
$oop64bitValue = [int]$oop64bit.ToBool()
627-
&$vsRegEdit set "$vsDir" $hive HKCU "Roslyn\Internal\OnOff\Features" OOP64Bit dword $oop64bitValue
652+
# Disable text editor error reporting because it pops up a dialog. We want to either fail fast in our
653+
# custom handler or fail silently and continue testing.
654+
&$vsRegEdit set "$vsDir" $hive HKCU "Text Editor" "Report Exceptions" dword 0
628655

629-
# Disable targeted notifications
630-
if ($ci) {
631-
# Currently does not work via vsregedit, so only apply this setting in CI
632-
#&$vsRegEdit set "$vsDir" $hive HKCU "RemoteSettings" TurnOffSwitch dword 1
633-
reg add hkcu\Software\Microsoft\VisualStudio\RemoteSettings /f /t REG_DWORD /v TurnOffSwitch /d 1
656+
# Configure RemoteHostOptions.OOP64Bit for testing
657+
$oop64bitValue = [int]$oop64bit.ToBool()
658+
&$vsRegEdit set "$vsDir" $hive HKCU "Roslyn\Internal\OnOff\Features" OOP64Bit dword $oop64bitValue
659+
660+
# Disable targeted notifications
661+
if ($ci) {
662+
# Currently does not work via vsregedit, so only apply this setting in CI
663+
#&$vsRegEdit set "$vsDir" $hive HKCU "RemoteSettings" TurnOffSwitch dword 1
664+
reg add hkcu\Software\Microsoft\VisualStudio\RemoteSettings /f /t REG_DWORD /v TurnOffSwitch /d 1
665+
}
666+
} finally {
667+
$vsixInstallerLogs = Join-Path $TempDir $logFileName
668+
CopyToArtifactLogs $vsixInstallerLogs
634669
}
635670
}
636671

0 commit comments

Comments
 (0)