Skip to content

Commit c74384b

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

File tree

2 files changed

+36
-35
lines changed

2 files changed

+36
-35
lines changed

eng/pipelines/templates/common.yml

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,35 +68,33 @@ extends:
6868

6969

7070
- ${{ each os in split('linux|windows|macOS', '|') }}:
71-
- ${{ if ne(stageDependencies.Initialize.Initialize.outputs[format('CreateBuildInfo.{0}BuildMatrix', os)], '') }}:
72-
- template: /eng/pipelines/templates/jobs/build.yml
73-
parameters:
74-
TestTimeoutInMinutes: 30
75-
ServerName: ${{ parameters.ServerName }}
76-
PublishTarget: ${{ parameters.PublishTarget }}
77-
OSName: ${{ os }}
78-
Matrix: stageDependencies.Initialize.Initialize.outputs['CreateBuildInfo.${{ os }}BuildMatrix']
79-
MaxParallel: 4
71+
- template: /eng/pipelines/templates/jobs/build.yml
72+
parameters:
73+
TestTimeoutInMinutes: 30
74+
ServerName: ${{ parameters.ServerName }}
75+
PublishTarget: ${{ parameters.PublishTarget }}
76+
OSName: ${{ os }}
77+
Matrix: stageDependencies.Initialize.Initialize.outputs['CreateBuildInfo.${{ os }}BuildMatrix']
78+
MaxParallel: 4
8079

8180
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), eq(parameters.RunLiveTests, 'true')) }}:
82-
- ${{ if ne(stageDependencies.Initialize.Initialize.outputs[CreateBuildInfo.liveTestMatrix], '') }}:
83-
- stage: Test
84-
displayName: 'Live test'
85-
dependsOn:
86-
- Initialize
87-
pool:
88-
name: $(LINUXPOOL)
89-
image: $(LINUXVMIMAGE)
90-
os: linux
91-
variables:
92-
- template: /eng/pipelines/templates/variables/image.yml
93-
- template: /eng/pipelines/templates/variables/globals.yml
94-
jobs:
95-
- template: /eng/pipelines/templates/jobs/live-test.yml
96-
parameters:
97-
Matrix: stageDependencies.Initialize.Initialize.outputs['CreateBuildInfo.liveTestMatrix']
98-
MaxParallel: 10
99-
TimeoutInMinutes: 75
81+
- stage: Test
82+
displayName: 'Live test'
83+
dependsOn:
84+
- Initialize
85+
pool:
86+
name: $(LINUXPOOL)
87+
image: $(LINUXVMIMAGE)
88+
os: linux
89+
variables:
90+
- template: /eng/pipelines/templates/variables/image.yml
91+
- template: /eng/pipelines/templates/variables/globals.yml
92+
jobs:
93+
- template: /eng/pipelines/templates/jobs/live-test.yml
94+
parameters:
95+
Matrix: stageDependencies.Initialize.Initialize.outputs['CreateBuildInfo.liveTestMatrix']
96+
MaxParallel: 10
97+
TimeoutInMinutes: 75
10098

10199
- ${{ if ne(parameters.PublishTarget, 'none') }}:
102100
# We only sign if we're going to publish

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)