mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
9 lines
455 B
Bash
Executable File
9 lines
455 B
Bash
Executable File
#!/bin/bash
|
|
|
|
branch=$(git symbolic-ref HEAD 2>&1) || error "cannot set kubectl namespace: no branch"
|
|
currentContext=$(kubectl config current-context 2>&1) || error "cannot set kubectl namespace: no current context"
|
|
namespace=staging-$(echo "$branch" | awk '{ sub(/^refs\/heads\//, ""); $0 = tolower($0); gsub(/[^-a-z0-9]/, "-"); print }')
|
|
|
|
echo "Setting kubectl namespace: $namespace"
|
|
kubectl config set-context "$currentContext" --namespace "$namespace"
|