Skip to content

Commit

Permalink
Skip env processing on matrix import step (#39160)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
  • Loading branch information
azure-sdk and benbp authored Mar 11, 2024
1 parent c11f1aa commit 44c019c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions eng/common/scripts/job-matrix/job-matrix-functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ function GenerateMatrix(
[String]$displayNameFilter = ".*",
[Array]$filters = @(),
[Array]$replace = @(),
[Array]$nonSparseParameters = @()
[Array]$nonSparseParameters = @(),
[Switch]$skipEnvironmentVariables
) {
$matrixParameters, $importedMatrix, $combinedDisplayNameLookup = `
ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup
Expand Down Expand Up @@ -124,7 +125,9 @@ function GenerateMatrix(

$matrix = FilterMatrix $matrix $filters
$matrix = ProcessReplace $matrix $replace $combinedDisplayNameLookup
$matrix = ProcessEnvironmentVariableReferences $matrix $combinedDisplayNameLookup
if (!$skipEnvironmentVariables) {
$matrix = ProcessEnvironmentVariableReferences $matrix $combinedDisplayNameLookup
}
$matrix = FilterMatrixDisplayName $matrix $displayNameFilter
return $matrix
}
Expand Down Expand Up @@ -427,10 +430,14 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
exit 1
}
$importedMatrixConfig = GetMatrixConfigFromFile (Get-Content -Raw $importPath)
# Add skipEnvironmentVariables so we don't process environment variables on import
# because we want top level filters to work against the the env key, not the value.
# The environment variables will get resolved after the import.
$importedMatrix = GenerateMatrix `
-config $importedMatrixConfig `
-selectFromMatrixType $selection `
-nonSparseParameters $nonSparseParameters
-nonSparseParameters $nonSparseParameters `
-skipEnvironmentVariables

$combinedDisplayNameLookup = $importedMatrixConfig.displayNamesLookup
foreach ($lookup in $displayNamesLookup.GetEnumerator()) {
Expand Down

0 comments on commit 44c019c

Please sign in to comment.