@@ -96,7 +96,8 @@ function GenerateMatrix(
96
96
[String ]$displayNameFilter = " .*" ,
97
97
[Array ]$filters = @ (),
98
98
[Array ]$replace = @ (),
99
- [Array ]$nonSparseParameters = @ ()
99
+ [Array ]$nonSparseParameters = @ (),
100
+ [Switch ]$skipEnvironmentVariables
100
101
) {
101
102
$matrixParameters , $importedMatrix , $combinedDisplayNameLookup = `
102
103
ProcessImport $config.matrixParameters $selectFromMatrixType $nonSparseParameters $config.displayNamesLookup
@@ -124,7 +125,9 @@ function GenerateMatrix(
124
125
125
126
$matrix = FilterMatrix $matrix $filters
126
127
$matrix = ProcessReplace $matrix $replace $combinedDisplayNameLookup
127
- $matrix = ProcessEnvironmentVariableReferences $matrix $combinedDisplayNameLookup
128
+ if (! $skipEnvironmentVariables ) {
129
+ $matrix = ProcessEnvironmentVariableReferences $matrix $combinedDisplayNameLookup
130
+ }
128
131
$matrix = FilterMatrixDisplayName $matrix $displayNameFilter
129
132
return $matrix
130
133
}
@@ -427,10 +430,14 @@ function ProcessImport([MatrixParameter[]]$matrix, [String]$selection, [Array]$n
427
430
exit 1
428
431
}
429
432
$importedMatrixConfig = GetMatrixConfigFromFile (Get-Content - Raw $importPath )
433
+ # Add skipEnvironmentVariables so we don't process environment variables on import
434
+ # because we want top level filters to work against the the env key, not the value.
435
+ # The environment variables will get resolved after the import.
430
436
$importedMatrix = GenerateMatrix `
431
437
- config $importedMatrixConfig `
432
438
- selectFromMatrixType $selection `
433
- - nonSparseParameters $nonSparseParameters
439
+ - nonSparseParameters $nonSparseParameters `
440
+ - skipEnvironmentVariables
434
441
435
442
$combinedDisplayNameLookup = $importedMatrixConfig.displayNamesLookup
436
443
foreach ($lookup in $displayNamesLookup.GetEnumerator ()) {
0 commit comments