Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools for PR 9294 (#38251)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Beddall <scbedd@microsoft.com>
  • Loading branch information
azure-sdk and scbedd authored Oct 31, 2024
1 parent 60e5527 commit a5474cf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@ foreach ($matrixBatchKey in $matrixBatchesByConfig.Keys) {
# we only need to modify the generated job name if there is more than one matrix config or batch in the matrix
$matrixSuffixNecessary = $matrixConfigs.Count -gt 1
$batchSuffixNecessary = $packageBatches.Length -gt 1
$batchCounter = 1

foreach ($batch in $packageBatches) {
# to understand this iteration, one must understand that the matrix is a list of hashtables, each with a couple keys:
# [
# { "name": "jobname", "parameters": { matrixSetting1: matrixValue1, ...} },
# ]
foreach ($matrixOutputItem in $matrixResults) {
$namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join "-"
$namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join ","
# we just need to iterate across them, grab the parameters hashtable, and add the new key
# if there is more than one batch, we will need to add a suffix including the batch name to the job name
$matrixOutputItem["parameters"]["$PRMatrixSetting"] = $namesForBatch
Expand All @@ -110,11 +111,12 @@ foreach ($matrixBatchKey in $matrixBatchesByConfig.Keys) {
}

if ($batchSuffixNecessary) {
$matrixOutputItem["name"] = $matrixOutputItem["name"] + $namesForBatch
$matrixOutputItem["name"] = $matrixOutputItem["name"] + "b$batchCounter"
}

$OverallResult += $matrixOutputItem
}
$batchCounter += 1
}
}
}
Expand Down

0 comments on commit a5474cf

Please sign in to comment.