fix k3d kubeconfig for Docker runner
Kube-bench CIS scan / Scan ephemeral K3s cluster (push) Failing after 55s

This commit is contained in:
2026-08-11 17:00:44 -04:00
parent 22ccecc363
commit c0a6c050b5
2 changed files with 10 additions and 0 deletions
+9
View File
@@ -42,6 +42,15 @@ jobs:
run: | run: |
k3d cluster delete security-baseline-ci >/dev/null 2>&1 || true k3d cluster delete security-baseline-ci >/dev/null 2>&1 || true
k3d cluster create --config ci/k3d-ci-cluster-config.yaml k3d cluster create --config ci/k3d-ci-cluster-config.yaml
mkdir -p "$HOME/.kube"
k3d kubeconfig get security-baseline-ci > "$HOME/.kube/config"
api_host=127.0.0.1
if getent hosts host.docker.internal >/dev/null 2>&1; then
api_host=host.docker.internal
elif command -v ip >/dev/null 2>&1; then
api_host="$(ip route | awk '/default/ {print $3; exit}')"
fi
sed -i -E "s#https://0\.0\.0\.0:#https://${api_host}:#" "$HOME/.kube/config"
kubectl wait --for=condition=Ready nodes --all --timeout=180s kubectl wait --for=condition=Ready nodes --all --timeout=180s
kubectl get nodes -o wide kubectl get nodes -o wide
@@ -141,6 +141,7 @@ ExecStart=/usr/bin/docker run --name gitea-runner --rm \\
--env GITEA_RUNNER_NAME \\ --env GITEA_RUNNER_NAME \\
--env GITEA_RUNNER_LABELS \\ --env GITEA_RUNNER_LABELS \\
--env-file /var/lib/gitea-runner/runner.env \\ --env-file /var/lib/gitea-runner/runner.env \\
--add-host host.docker.internal:host-gateway \\
--volume /var/run/docker.sock:/var/run/docker.sock \\ --volume /var/run/docker.sock:/var/run/docker.sock \\
--volume /var/lib/gitea-runner:/data \\ --volume /var/lib/gitea-runner:/data \\
$GITEA_RUNNER_IMAGE $GITEA_RUNNER_IMAGE