From fcb0018216ea463d8071e0937823601dc8696ea3 Mon Sep 17 00:00:00 2001 From: Chris Farhood Date: Tue, 5 May 2026 19:47:08 +0000 Subject: [PATCH] Fix E2E kubeconfig: locate kubeconfig before RBAC step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'kubectl auth can-i --as' impersonation check was falling back to localhost:8080 because KUBECONFIG was not set and the ARC runner's kubeconfig was not in the default location. azure/setup-kubectl@v4 does not set KUBECONFIG — it installs kubectl and relies on the runner's existing kubeconfig in /runner/.kube/config (ARC runner home). Add a 'Locate kubeconfig for ARC runner' step that searches the known runner kubeconfig paths before the RBAC step runs, exports KUBECONFIG to GITHUB_ENV, and verifies cluster connectivity before proceeding. Fixes: PRI-785 Co-Authored-By: Paperclip --- .github/workflows/e2e.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index 61340b9..e769e6a 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -45,6 +45,23 @@ jobs: - name: Setup kubectl uses: azure/setup-kubectl@v4 + - name: Locate kubeconfig for ARC runner + run: | + set -euo pipefail + for dir in /runner /home/runner/.kube /home/github/.kube; do + if [ -f "${dir}/config" ]; then + echo "Found kubeconfig at ${dir}/config" + echo "KUBECONFIG=${dir}/config" >> "$GITHUB_ENV" + break + fi + done + if [ -z "${KUBECONFIG:-}" ]; then + echo "::error::No kubeconfig found for ARC runner. Checked: /runner, ~/.kube, ~/kube" + exit 1 + fi + echo "Using kubeconfig: ${KUBECONFIG}" + kubectl cluster-info --request-timeout=5s + - name: Apply RBAC for E2E pipeline run: | set -x