From 727e48b9b94a369c38cf44efe793357fcf032af1 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 30 Oct 2024 18:28:53 -0700 Subject: [PATCH 1/2] fix the integration problem --- .../scripts/job-matrix/Create-PrJobMatrix.ps1 | 4 ++- .../job-matrix/job-matrix-functions.ps1 | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 b/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 index b7c3b9d3ae..5129d757f9 100644 --- a/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 +++ b/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 @@ -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 diff --git a/eng/common/scripts/job-matrix/job-matrix-functions.ps1 b/eng/common/scripts/job-matrix/job-matrix-functions.ps1 index f20dbe5281..9bd5682e1c 100644 --- a/eng/common/scripts/job-matrix/job-matrix-functions.ps1 +++ b/eng/common/scripts/job-matrix/job-matrix-functions.ps1 @@ -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 + } \ No newline at end of file From 65eb2da5f12744bd70c74f44fe59cbf14332f475 Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 30 Oct 2024 18:31:55 -0700 Subject: [PATCH 2/2] add newline at end of file --- eng/common/scripts/job-matrix/job-matrix-functions.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/common/scripts/job-matrix/job-matrix-functions.ps1 b/eng/common/scripts/job-matrix/job-matrix-functions.ps1 index 9bd5682e1c..0693f7983f 100644 --- a/eng/common/scripts/job-matrix/job-matrix-functions.ps1 +++ b/eng/common/scripts/job-matrix/job-matrix-functions.ps1 @@ -764,4 +764,4 @@ function GenerateMatrixForConfig { -replace $Replace return , $matrix - } \ No newline at end of file +}