From 067a627959e51c2e83c6c29f52ecd54990133de7 Mon Sep 17 00:00:00 2001 From: s871077 Date: Wed, 16 Sep 2026 16:08:30 +0800 Subject: [PATCH] add network debug in cicd.yaml --- .github/workflows/cicd.yaml | 67 +++++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 68 insertions(+) diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index 6c634f8..eff9ae1 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -72,6 +72,73 @@ jobs: echo "${{ secrets.KUBE_CONFIG_DATA }}" | base64 -d > "${RUNNER_TEMP}/kubeconfig" chmod 600 "${RUNNER_TEMP}/kubeconfig" + # Temporary debug step: we cannot shell into this self-hosted runner + # directly, so this proves (or disproves) network reachability to the + # k8s API from inside the runner itself, ahead of the image build/push + # so we fail fast instead of waiting ~10 min for the helm timeout. + # Remove once the ACL/connectivity issue is confirmed fixed. + - name: "[DEBUG] Network path to k8s API (6443)" + run: | + set +e + echo "===== Runner identity / network info =====" + hostname -f 2>/dev/null || hostname + echo "--- Interfaces ---" + ip -brief addr show 2>/dev/null || ifconfig + echo "--- Default route ---" + ip route show 2>/dev/null || route -n + + echo + echo "===== K8s API endpoint (parsed from kubeconfig) =====" + KUBE_HOST=$(grep -m1 'server:' "${KUBECONFIG}" | sed -E 's#.*https?://([^:/]+).*#\1#') + KUBE_PORT=$(grep -m1 'server:' "${KUBECONFIG}" | sed -E 's#.*:([0-9]+)/?.*#\1#') + KUBE_PORT="${KUBE_PORT:-6443}" + echo "Host: ${KUBE_HOST}" + echo "Port: ${KUBE_PORT}" + + echo + echo "===== DNS resolution =====" + getent hosts "${KUBE_HOST}" || nslookup "${KUBE_HOST}" || dig +short "${KUBE_HOST}" + + RESOLVED_IPS=$(getent hosts "${KUBE_HOST}" | awk '{print $1}') + + echo + echo "===== Route to each resolved IP =====" + for ip in ${RESOLVED_IPS}; do + echo "-- ip route get ${ip} --" + ip route get "${ip}" 2>/dev/null || echo "(ip route not available)" + done + + echo + echo "===== TCP connect test per resolved IP (port ${KUBE_PORT}) =====" + for ip in ${RESOLVED_IPS}; do + if timeout 5 bash -c "cat < /dev/null > /dev/tcp/${ip}/${KUBE_PORT}" 2>/dev/null; then + echo "OK ${ip}:${KUBE_PORT} - TCP connect succeeded" + else + echo "FAIL ${ip}:${KUBE_PORT} - TCP connect timed out or refused" + fi + done + + echo + echo "===== TCP connect test via hostname (through NLB, port ${KUBE_PORT}) =====" + if timeout 5 bash -c "cat < /dev/null > /dev/tcp/${KUBE_HOST}/${KUBE_PORT}" 2>/dev/null; then + echo "OK ${KUBE_HOST}:${KUBE_PORT} - TCP connect succeeded" + else + echo "FAIL ${KUBE_HOST}:${KUBE_PORT} - TCP connect timed out or refused" + fi + + echo + echo "===== curl -v (expect HTTP 401/403 = reachable; a hang/timeout = blocked) =====" + curl -v -k --max-time 8 "https://${KUBE_HOST}:${KUBE_PORT}/version" + + echo + echo "===== traceroute (best effort, may be blocked itself) =====" + if command -v traceroute >/dev/null 2>&1; then + traceroute -T -p "${KUBE_PORT}" -w 2 -m 15 "${KUBE_HOST}" || true + else + echo "traceroute not installed on runner, skipping" + fi + set -e + - name: Login to JFrog run: | # JFROG_REGISTRY is host/repo but `docker login` takes only the host. diff --git a/.gitignore b/.gitignore index 8f42642..7a6bbd4 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ yarn-error.log* # local env files .env*.local +.env.production.example # production env (contains real RDS credentials) - use .env.production.example as template .env.production