Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync eng/common directory with azure-sdk-tools for PR 9290 #1885

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ $packageProperties = Get-ChildItem -Recurse "$PackagePropertiesFolder" *.json `

# set default matrix config for each package if there isn't an override
$packageProperties | ForEach-Object {
$_.CIMatrixConfigs = $_.CIMatrixConfigs ?? $configs
if (-not $_.CIMatrixConfigs) {
$_.CIMatrixConfigs = $configs
}
}

# The key here is that after we group the packages by the matrix config objects, we can use the first item's MatrixConfig
Expand Down
25 changes: 25 additions & 0 deletions eng/common/scripts/job-matrix/job-matrix-functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -740,3 +740,28 @@ function Get4dMatrixIndex([int]$index, [Array]$dimensions) {
return @($page3, $page2, $page1, $remainder)
}

function GenerateMatrixForConfig {
param (
[Parameter(Mandatory = $true)][string] $ConfigPath,
[Parameter(Mandatory = $True)][string] $Selection,
[Parameter(Mandatory = $false)][string] $DisplayNameFilter,
[Parameter(Mandatory = $false)][array] $Filters,
[Parameter(Mandatory = $false)][array] $Replace
)
$matrixFile = Join-Path $PSScriptRoot ".." ".." ".." ".." $ConfigPath

$resolvedMatrixFile = Resolve-Path $matrixFile

$config = GetMatrixConfigFromFile (Get-Content $resolvedMatrixFile -Raw)
# Strip empty string filters in order to be able to use azure pipelines yaml join()
$Filters = $Filters | Where-Object { $_ }

[array]$matrix = GenerateMatrix `
-config $config `
-selectFromMatrixType $Selection `
-displayNameFilter $DisplayNameFilter `
-filters $Filters `
-replace $Replace

return , $matrix
}