gitpod/scripts/branch-namespace.sh
Mads Hartmann afa2bd1cb8 Allow for branch name lengths of 45
This relaxes the branch name restriction from 20 characters to 45. This is achieved by constructing the preview name based on the first 10 characters of the branch name and then the first 10 characters of the hashed value of the branch name.

All places that (to my knowledge) rely on the preview name has been updated.

Fixes https://github.com/gitpod-io/ops/issues/1252
2022-03-11 13:50:18 +05:30

10 lines
346 B
Bash
Executable File

#!/bin/bash
source ./dev/preview/util/preview-name-from-branch.sh
currentContext=$(kubectl config current-context 2>&1) || error "cannot set kubectl namespace: no current context"
namespace="staging-$(preview-name-from-branch)"
echo "Setting kubectl namespace: $namespace"
kubectl config set-context "$currentContext" --namespace "$namespace"