diff --git a/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 b/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 index 73731e410..bda7da1a6 100644 --- a/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 +++ b/eng/common/scripts/stress-testing/find-all-stress-packages.ps1 @@ -45,9 +45,18 @@ function NewStressTestPackageInfo([hashtable]$chart, [System.IO.FileInfo]$chartF $namespace = if ($CI) { $chart.annotations.namespace } else { - $namespace = if ($env:USER) { $env:USER } else { "${env:USERNAME}" } - # Remove spaces, etc. that may be in $namespace - $namespace -replace '\W' + # Check GITHUB_USER for users in codespaces environments, since the default user is `codespaces` and + # we would like to avoid namespace overlaps for different codespaces users. + $namespace = if ($env:GITHUB_USER) { + $env:GITHUB_USER + } elseif ($env:USER) { + $env:USER + } else { + $env:USERNAME + } + # Remove spaces, underscores, etc. that may be in $namespace. Value must be a valid RFC 1123 DNS label: + # https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names + $namespace -replace '_|\W', '-' } return [StressTestPackageInfo]@{