Skip to content

Commit f1f85b3

Browse files
scbeddazure-sdk
authored andcommitted
we now pass the combined MatrixConfigs through to the Create-PRJobMatrix. they are treated as the default, versus some PRMatrix setting that is manually set
1 parent 7107f89 commit f1f85b3

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

eng/common/pipelines/templates/jobs/generate-job-matrix.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ parameters:
4545
- name: EnablePRGeneration
4646
type: boolean
4747
default: false
48-
- name: PRMatrix
49-
type: object
50-
# Mappings to OS name required at template compile time by 1es pipeline templates
48+
- name: PRMatrixSetting
49+
type: string
50+
default: 'ArtifactPackageNames'
5151
- name: Pools
5252
type: object
5353
default:
@@ -124,16 +124,16 @@ jobs:
124124
# Not currently not hardcoded, so not doing the needful and populating this folder before we hit this step will result in generation errors.
125125
- ${{ else }}:
126126
- ${{ each pool in parameters.Pools }}:
127-
- task: Powershell@2
128-
inputs:
129-
pwsh: true
130-
filePath: eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1
131-
arguments: >
132-
-PackagePropertiesFolder $(Build.ArtifactStagingDirectory)/PackageInfo
133-
-PRMatrixFile ${{ parameters.PRMatrix.Path }}
134-
-PRMatrixSetting ${{ parameters.PRMatrix.Setting }}
135-
-DisplayNameFilter '$(displayNameFilter)'
136-
-Filters '${{ join(''',''', parameters.MatrixFilters) }}', 'container=^$', 'SupportedClouds=^$|${{ parameters.CloudConfig.Cloud }}', 'Pool=${{ pool.filter }}'
127+
- pwsh: |
128+
# dump the conglomerated CI matrix
129+
'${{ convertToJson(parameters.MatrixConfigs) }}' | Set-Content matrix.json
130+
131+
./eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 `
132+
-PackagePropertiesFolder $(Build.ArtifactStagingDirectory)/PackageInfo `
133+
-PRMatrixFile matrix.json `
134+
-PRMatrixSetting ${{ parameters.PRMatrixSetting }} `
135+
-DisplayNameFilter '$(displayNameFilter)' `
136+
-Filters '${{ join(''',''', parameters.MatrixFilters) }}', 'container=^$', 'SupportedClouds=^$|${{ parameters.CloudConfig.Cloud }}', 'Pool=${{ pool.filter }}' `
137137
-Replace '${{ join(''',''', parameters.MatrixReplace) }}'
138138
displayName: Create ${{ pool.name }} PR Matrix
139139
name: vm_job_matrix_pr_${{ pool.name }}

eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,14 @@ if (!(Test-Path $PackagePropertiesFolder)) {
4949
exit 1
5050
}
5151

52+
if (!(Test-Path $PRMatrixFile)) {
53+
Write-Error "PR Matrix file doesn't exist"
54+
exit 1
55+
}
56+
5257
Write-Host "Generating PR job matrix for $PackagePropertiesFolder"
5358

54-
# this will become a parameter in the future, we will pass MatrixConfigs as a parameter
55-
# these will be the "default" matrices that we will use to generate the PR matrix in lieu of
56-
# a matrix file
57-
$configs = @(
58-
[PsCustomObject]@{
59-
Name = "default_platform_matrix"
60-
Path = $PRMatrixFile
61-
Selection = "sparse"
62-
}
63-
)
59+
$configs = Get-Content -Raw $PRMatrixFile | ConvertFrom-Json | ForEach-Object { [PSCustomObject]$_ }
6460

6561
# calculate general targeting information and create our batches prior to generating any matrix
6662
$packageProperties = Get-ChildItem -Recurse "$PackagePropertiesFolder" *.json `

0 commit comments

Comments
 (0)