Skip to content

Commit 3bd9b80

Browse files
Set matrices content to empty if ther are no paths to test
1 parent d139fb7 commit 3bd9b80

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

eng/scripts/New-BuildInfo.ps1

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,14 +608,10 @@ Push-Location $RepoRoot
608608
try {
609609
$serverDetails = @(Get-ServerDetails)
610610
$pathsToTest = @(Get-PathsToTest)
611-
$matrices = [ordered]@{}
612-
613-
if ($pathsToTest.Count -gt 0) {
614-
$matrices = Get-BuildMatrices $serverDetails
615-
$matrices['liveTestMatrix'] = Get-TestMatrix $pathsToTest -TestType 'Live'
616-
$matrices['serverMatrix'] = Get-ServerMatrix $serverDetails
617-
}
618-
611+
$matrices = Get-BuildMatrices $serverDetails
612+
$matrices['liveTestMatrix'] = Get-TestMatrix $pathsToTest -TestType 'Live'
613+
$matrices['serverMatrix'] = Get-ServerMatrix $serverDetails
614+
619615
# spellchecker: ignore SOURCEVERSION
620616
$branch = $isPipelineRun ? (CheckVariable 'BUILD_SOURCEBRANCH') : (git rev-parse --abbrev-ref HEAD)
621617
$commitSha = $isPipelineRun ? (CheckVariable 'BUILD_SOURCEVERSION') : (git rev-parse HEAD)
@@ -638,6 +634,13 @@ try {
638634

639635
$buildInfo | ConvertTo-Json -Depth 5 | Out-File -FilePath $OutputPath -Encoding utf8 -Force
640636

637+
# if path to test is empty, set all matrices to empty
638+
if (pathsToTest.Count -eq 0) {
639+
foreach ($key in $matrices.Keys) {
640+
$matrices[$key] = @{}
641+
}
642+
}
643+
641644
if ($isPipelineRun) {
642645
foreach($key in $matrices.Keys) {
643646
$matrixJson = $matrices[$key] | ConvertTo-Json -Compress

0 commit comments

Comments
 (0)