feat: export K8S_NS

This commit is contained in:
ange 2024-05-15 19:41:54 +02:00
parent 6bf1ef88a2
commit 84ec9cf196
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D

View File

@ -6,12 +6,12 @@ set -a
set +a set +a
REGISTRY="${IMAGEAPP%%/*}" REGISTRY="${IMAGEAPP%%/*}"
NS="${GITHUB_REPOSITORY#*/}-${GITHUB_REF_NAME}" export K8S_NS="${GITHUB_REPOSITORY#*/}-${GITHUB_REF_NAME}"
mkdir -p "$HOME/.kube/" mkdir -p "$HOME/.kube/"
echo "$INPUT_KUBECONFIG" > "$HOME/.kube/config" echo "$INPUT_KUBECONFIG" > "$HOME/.kube/config"
kubectl get namespace "$NS" || kubectl create namespace "$NS" kubectl get namespace "$K8S_NS" || kubectl create namespace "$K8S_NS"
kubectl config set-context --current --namespace="$NS" kubectl config set-context --current --namespace="$K8S_NS"
if [ -n "$INPUT_REGISTRY_PASSWORD" ]; then if [ -n "$INPUT_REGISTRY_PASSWORD" ]; then
kubectl get secret regcred \ kubectl get secret regcred \