From 96c34a9480168111cd3b20babc7ed3cdc98a51ca Mon Sep 17 00:00:00 2001 From: Scott Beddall Date: Wed, 30 Oct 2024 15:44:06 -0700 Subject: [PATCH] CIMatrixConfig null coalesce operator. Add the property CIMatrixConfigs --- eng/common/scripts/Package-Properties.ps1 | 1 + eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/eng/common/scripts/Package-Properties.ps1 b/eng/common/scripts/Package-Properties.ps1 index 77d4c9ea2d..572ecbe449 100644 --- a/eng/common/scripts/Package-Properties.ps1 +++ b/eng/common/scripts/Package-Properties.ps1 @@ -21,6 +21,7 @@ class PackageProps # additional packages required for validation of this one [string[]]$AdditionalValidationPackages [HashTable]$ArtifactDetails + [HashTable[]]$CIMatrixConfigs PackageProps([string]$name, [string]$version, [string]$directoryPath, [string]$serviceDirectory) { diff --git a/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 b/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 index 5129d757f9..b7c3b9d3ae 100644 --- a/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 +++ b/eng/common/scripts/job-matrix/Create-PrJobMatrix.ps1 @@ -64,9 +64,7 @@ $packageProperties = Get-ChildItem -Recurse "$PackagePropertiesFolder" *.json ` # set default matrix config for each package if there isn't an override $packageProperties | ForEach-Object { - if (-not $_.CIMatrixConfigs) { - $_.CIMatrixConfigs = $configs - } + $_.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