Sync eng/common directory with azure-sdk-tools for PR 9393 (#31815)

Sync eng/common directory with azure-sdk-tools for PR
https://github.com/Azure/azure-sdk-tools/pull/9393 See [eng/common
workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow)

Co-authored-by: Scott Beddall <scbedd@microsoft.com>
This commit is contained in:
Azure SDK Bot 2024-11-18 12:57:29 -08:00 коммит произвёл GitHub
Родитель 65f7d305dd
Коммит 247d23e8dd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -90,31 +90,33 @@ foreach ($matrixBatchKey in $matrixBatchesByConfig.Keys) {
$packageBatches = Split-ArrayIntoBatches -InputArray $matrixBatch -BatchSize $BATCHSIZE $packageBatches = Split-ArrayIntoBatches -InputArray $matrixBatch -BatchSize $BATCHSIZE
# we only need to modify the generated job name if there is more than one matrix config or batch in the matrix # we only need to modify the generated job name if there is more than one matrix config + batch
$matrixSuffixNecessary = $matrixConfigs.Count -gt 1 $matrixSuffixNecessary = $matrixBatchesByConfig.Keys.Count -gt 1
$batchSuffixNecessary = $packageBatches.Length -gt 1 $batchSuffixNecessary = $packageBatches.Length -gt 1
$batchCounter = 1 $batchCounter = 1
foreach ($batch in $packageBatches) { foreach ($batch in $packageBatches) {
$namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join ","
# to understand this iteration, one must understand that the matrix is a list of hashtables, each with a couple keys: # 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, ...} }, # { "name": "jobname", "parameters": { matrixSetting1: matrixValue1, ...} },
# ] # ]
foreach ($matrixOutputItem in $matrixResults) { foreach ($matrixOutputItem in $matrixResults) {
$namesForBatch = ($batch | ForEach-Object { $_.ArtifactName }) -join "," # we need to clone this, as each item is an object with possible children
$outputItem = $matrixOutputItem | ConvertTo-Json -Depth 100 | ConvertFrom-Json -AsHashtable
# we just need to iterate across them, grab the parameters hashtable, and add the new key # 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 # 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 $outputItem["parameters"]["$PRMatrixSetting"] = $namesForBatch
if ($matrixSuffixNecessary) { if ($matrixSuffixNecessary) {
$matrixOutputItem["name"] = $matrixOutputItem["name"] + $matrixConfig.Name $outputItem["name"] = $outputItem["name"] + "_" + $matrixConfig.Name
} }
if ($batchSuffixNecessary) { if ($batchSuffixNecessary) {
$matrixOutputItem["name"] = $matrixOutputItem["name"] + "b$batchCounter" $outputItem["name"] = $outputItem["name"] + "_b$batchCounter"
} }
$OverallResult += $matrixOutputItem $OverallResult += $outputItem
} }
$batchCounter += 1 $batchCounter += 1
} }

Просмотреть файл

@ -490,7 +490,7 @@ function CloneOrderedDictionary([System.Collections.Specialized.OrderedDictionar
function SerializePipelineMatrix([Array]$matrix) { function SerializePipelineMatrix([Array]$matrix) {
$pipelineMatrix = [Ordered]@{} $pipelineMatrix = [Ordered]@{}
foreach ($entry in $matrix) { foreach ($entry in $matrix) {
if ($pipelineMatrix.Contains($entry.Name)) { if ($pipelineMatrix.Contains($entry.name)) {
Write-Warning "Found duplicate configurations for job `"$($entry.name)`". Multiple values may have been replaced with the same value." Write-Warning "Found duplicate configurations for job `"$($entry.name)`". Multiple values may have been replaced with the same value."
continue continue
} }