diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 4c7ccca..790f0f7 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,6 +7,7 @@ on: env: REGISTRY_IMAGE: registry.neko-piranha.ts.net/astral/buzz-sheet DEPLOY_NAMESPACE: buzz-sheet + KUBE_API_SERVER: https://100.75.220.33:6443/ jobs: verify: @@ -92,6 +93,10 @@ jobs: export KUBECONFIG="$kube_dir/config" printf '%s' "$KUBE_CONFIG_B64" | base64 --decode >"$KUBECONFIG" chmod 600 "$KUBECONFIG" + cluster_name="$(kubectl config view --kubeconfig "$KUBECONFIG" --minify -o jsonpath='{.clusters[0].name}')" + kubectl config set-cluster "$cluster_name" \ + --kubeconfig "$KUBECONFIG" \ + --server "$KUBE_API_SERVER" >/dev/null env_file="${GITEA_ENV_FILE:-${GITHUB_ENV:-}}" if [ -n "$env_file" ]; then @@ -124,6 +129,14 @@ jobs: echo "KUBE_CONFIG_B64 decoded to an empty kubeconfig" >&2 exit 1 fi + cluster_name="$(kubectl config view --kubeconfig "$KUBECONFIG" --minify -o jsonpath='{.clusters[0].name}')" + if [ -z "$cluster_name" ]; then + echo "Decoded kubeconfig has no active cluster" >&2 + exit 1 + fi + kubectl config set-cluster "$cluster_name" \ + --kubeconfig "$KUBECONFIG" \ + --server "$KUBE_API_SERVER" >/dev/null revision_short="${REVISION:0:12}" migration_dir="$RUNNER_TEMP/buzz-sheet-migration-$revision_short"