@@ -9,7 +9,7 @@ class StressTestPackageInfo {
9
9
[string ]$ReleaseName
10
10
}
11
11
12
- function FindStressPackages ([string ]$directory , [hashtable ]$filters = @ {}) {
12
+ function FindStressPackages ([string ]$directory , [hashtable ]$filters = @ {}, [ boolean ] $CI = $false ) {
13
13
# Bare minimum filter for stress tests
14
14
$filters [' stressTest' ] = ' true'
15
15
@@ -18,7 +18,7 @@ function FindStressPackages([string]$directory, [hashtable]$filters = @{}) {
18
18
foreach ($chartFile in $chartFiles ) {
19
19
$chart = ParseChart $chartFile
20
20
if (matchesAnnotations $chart $filters ) {
21
- $packages += NewStressTestPackageInfo $chart $chartFile
21
+ $packages += NewStressTestPackageInfo $chart $chartFile $CI
22
22
}
23
23
}
24
24
@@ -39,9 +39,17 @@ function MatchesAnnotations([hashtable]$chart, [hashtable]$filters) {
39
39
return $true
40
40
}
41
41
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
+
43
51
return [StressTestPackageInfo ]@ {
44
- Namespace = $chart .annotations. namespace
52
+ Namespace = $namespace
45
53
Directory = $chartFile.DirectoryName
46
54
ReleaseName = $chart.name
47
55
}
0 commit comments