fix(e2e): explicit kubeconfig path with fail-fast instead of silent fallback

The previous loop silently skipped if no kubeconfig was found, causing
kubectl commands to fall back to localhost:8080. Use explicit paths
in priority order with a hard error if none exist.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-05-05 20:27:07 +00:00
committed by Hugh Hackman [agent]
parent 7c55bfac01
commit 20453c7223
+13 -6
View File
@@ -48,12 +48,19 @@ jobs:
- name: Get kubeconfig
run: |
set -euo pipefail
for path in /runner/config "$HOME/.kube/config" "$HOME/.kube" /home/runner/.kube/config /home/runner/.kube; do
if [ -f "$path" ]; then
echo "KUBECONFIG=${path}" >> "$GITHUB_ENV"
break
fi
done
if [ -f /runner/config ]; then
echo "KUBECONFIG=/runner/config" >> "$GITHUB_ENV"
echo "Using kubeconfig from /runner/config"
elif [ -f /home/runner/.kube/config ]; then
echo "KUBECONFIG=/home/runner/.kube/config" >> "$GITHUB_ENV"
echo "Using kubeconfig from /home/runner/.kube/config"
elif [ -f "$HOME/.kube/config" ]; then
echo "KUBECONFIG=$HOME/.kube/config" >> "$GITHUB_ENV"
echo "Using kubeconfig from HOME"
else
echo "::error::No kubeconfig found in /runner/config, /home/runner/.kube/config, or HOME"
exit 1
fi
- name: Apply RBAC for E2E pipeline
run: |