@@ -40,12 +40,13 @@ param (
40
40
[Parameter (Mandatory = $true )][string ] $PackagePropertiesFolder ,
41
41
[Parameter (Mandatory = $true )][string ] $PRMatrixFile ,
42
42
[Parameter (Mandatory = $true )][string ] $PRMatrixSetting ,
43
- [Parameter (Mandatory = $False )][string ] $DisplayNameFilter ,
44
- [Parameter (Mandatory = $False )][array ] $Filters ,
45
- [Parameter (Mandatory = $False )][array ] $IndirectFilters ,
46
- [Parameter (Mandatory = $False )][array ] $Replace ,
47
- [Parameter (Mandatory = $False )][bool ] $SparseIndirect = $true ,
48
- [Parameter (Mandatory = $False )][int ] $PackagesPerPRJob = 10 ,
43
+ [Parameter (Mandatory = $false )][string ] $DisplayNameFilter ,
44
+ [Parameter (Mandatory = $false )][array ] $Filters ,
45
+ [Parameter (Mandatory = $false )][array ] $IndirectFilters ,
46
+ [Parameter (Mandatory = $false )][array ] $Replace ,
47
+ [Parameter (Mandatory = $false )][string ] $PRMatrixKey = " ArtifactName" ,
48
+ [Parameter (Mandatory = $false )][bool ] $SparseIndirect = $true ,
49
+ [Parameter (Mandatory = $false )][int ] $PackagesPerPRJob = 10 ,
49
50
[Parameter ()][switch ] $CI = ($null -ne $env: SYSTEM_TEAMPROJECTID )
50
51
)
51
52
@@ -74,6 +75,7 @@ function QueuePop([ref]$queue) {
74
75
function GeneratePRMatrixForBatch {
75
76
param (
76
77
[Parameter (Mandatory = $true )][array ] $Packages ,
78
+ [Parameter (Mandatory = $true )][array ] $MatrixKey ,
77
79
[Parameter (Mandatory = $false )][bool ] $FullSparseMatrix = $false
78
80
)
79
81
@@ -104,7 +106,7 @@ function GeneratePRMatrixForBatch {
104
106
$matrixResults = @ ()
105
107
106
108
if (! $matrixConfig ) {
107
- Write-Error " Unable to find matrix config for $matrixBatchKey . Check the package properties for the package $ ( $matrixBatch [0 ].ArtifactName ) ."
109
+ Write-Error " Unable to find matrix config for $matrixBatchKey . Check the package properties for the package $ ( $matrixBatch [0 ].( $MatrixKey ) ) ."
108
110
exit 1
109
111
}
110
112
@@ -166,7 +168,7 @@ function GeneratePRMatrixForBatch {
166
168
$batchCounter = 1
167
169
168
170
foreach ($batch in $packageBatches ) {
169
- $namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join " ,"
171
+ $namesForBatch = ($batch | ForEach-Object { $_ .( $MatrixKey ) }) -join " ,"
170
172
171
173
foreach ($matrixOutputItem in $matrixResults ) {
172
174
# we need to clone this, as each item is an object with possible children
@@ -195,7 +197,7 @@ function GeneratePRMatrixForBatch {
195
197
$batchSuffixNecessary = $packageBatches.Length -gt 0
196
198
$batchCounter = 1
197
199
foreach ($batch in $packageBatches ) {
198
- $namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join " ,"
200
+ $namesForBatch = ($batch | ForEach-Object { $_ .( $MatrixKey ) }) -join " ,"
199
201
$outputItem = QueuePop - queue ([ref ]$matrixResults )
200
202
201
203
$outputItem [" parameters" ][" $PRMatrixSetting " ] = $namesForBatch
@@ -228,7 +230,7 @@ if (!(Test-Path $PRMatrixFile)) {
228
230
exit 1
229
231
}
230
232
231
- Write-Host " Generating PR job matrix for $PackagePropertiesFolder "
233
+ Write-Host " Generating PR job matrix for $PackagePropertiesFolder using accesskey $PRMatrixKey to determine artifact batches. "
232
234
233
235
$configs = Get-Content - Raw $PRMatrixFile | ConvertFrom-Json
234
236
@@ -251,16 +253,16 @@ $OverallResult = @()
251
253
if ($directPackages ) {
252
254
Write-Host " Discovered $ ( $directPackages.Length ) direct packages"
253
255
foreach ($artifact in $directPackages ) {
254
- Write-Host " -> $ ( $artifact.ArtifactName ) "
256
+ Write-Host " -> $ ( $artifact .( $PRMatrixKey ) ) "
255
257
}
256
- $OverallResult += (GeneratePRMatrixForBatch - Packages $directPackages ) ?? @ ()
258
+ $OverallResult += (GeneratePRMatrixForBatch - Packages $directPackages - MatrixKey $PRMatrixKey ) ?? @ ()
257
259
}
258
260
if ($indirectPackages ) {
259
261
Write-Host " Discovered $ ( $indirectPackages.Length ) indirect packages"
260
262
foreach ($artifact in $indirectPackages ) {
261
- Write-Host " -> $ ( $artifact.ArtifactName ) "
263
+ Write-Host " -> $ ( $artifact .( $PRMatrixKey ) ) "
262
264
}
263
- $OverallResult += (GeneratePRMatrixForBatch - Packages $indirectPackages - FullSparseMatrix (-not $SparseIndirect )) ?? @ ()
265
+ $OverallResult += (GeneratePRMatrixForBatch - Packages $indirectPackages - MatrixKey $PRMatrixKey - FullSparseMatrix (-not $SparseIndirect )) ?? @ ()
264
266
}
265
267
$serialized = SerializePipelineMatrix $OverallResult
266
268
0 commit comments