@@ -9,7 +9,7 @@ class StressTestPackageInfo {
99 [string ]$ReleaseName
1010}
1111
12- function FindStressPackages ([string ]$directory , [hashtable ]$filters = @ {}) {
12+ function FindStressPackages ([string ]$directory , [hashtable ]$filters = @ {}, [ boolean ] $CI = $false ) {
1313 # Bare minimum filter for stress tests
1414 $filters [' stressTest' ] = ' true'
1515
@@ -18,7 +18,7 @@ function FindStressPackages([string]$directory, [hashtable]$filters = @{}) {
1818 foreach ($chartFile in $chartFiles ) {
1919 $chart = ParseChart $chartFile
2020 if (matchesAnnotations $chart $filters ) {
21- $packages += NewStressTestPackageInfo $chart $chartFile
21+ $packages += NewStressTestPackageInfo $chart $chartFile $CI
2222 }
2323 }
2424
@@ -39,9 +39,17 @@ function MatchesAnnotations([hashtable]$chart, [hashtable]$filters) {
3939 return $true
4040}
4141
42- function NewStressTestPackageInfo ([hashtable ]$chart , [System.IO.FileInfo ]$chartFile ) {
42+ function NewStressTestPackageInfo ([hashtable ]$chart , [System.IO.FileInfo ]$chartFile , [boolean ]$CI ) {
43+ $namespace = if ($CI ) {
44+ $chart.annotations.namespace
45+ } else {
46+ $namespace = if ($env: USER ) { $env: USER } else { " ${env: USERNAME} " }
47+ # Remove spaces, etc. that may be in $namespace
48+ $namespace -replace ' \W'
49+ }
50+
4351 return [StressTestPackageInfo ]@ {
44- Namespace = $chart .annotations. namespace
52+ Namespace = $namespace
4553 Directory = $chartFile.DirectoryName
4654 ReleaseName = $chart.name
4755 }
0 commit comments