Support github user namespaces for codespaces environments (#3316)
Co-authored-by: Ben Broderick Phillips <bebroder@microsoft.com>
This commit is contained in:
parent
514080fa0c
commit
4e67da9775
@ -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]@{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user