From 8e25fd474b88e8e38e0ea0785a44e807c8019138 Mon Sep 17 00:00:00 2001 From: gitea Date: Fri, 23 Oct 2026 10:44:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=A8=20alpine/k8s=20=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E6=97=A0=20shell=20=E7=9A=84=20kubectl=20=E9=95=9C?= =?UTF-8?q?=E5=83=8F=EF=BC=9B=E5=86=92=E7=83=9F=E6=B5=8B=E8=AF=95=E6=94=B9?= =?UTF-8?q?=E7=94=A8=20service=20DNS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e134934..9b52221 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ spec: - name: docker-config mountPath: /kaniko/.docker - name: kubectl - image: rancher/kubectl:v1.34.9 + image: alpine/k8s:1.34.12 command: ["sleep"] args: ["999999"] volumes: @@ -92,11 +92,9 @@ spec: sh ''' set -e for i in $(seq 1 20); do - CODE=$(kubectl -n apps run smoke-$$ --rm -i --restart=Never \ - --image=curlimages/curl:8.10.1 --quiet -- \ - -s -o /dev/null -w "%{http_code}" http://blog/healthz 2>/dev/null || echo 000) - if [ "$CODE" = "200" ]; then echo "健康检查通过"; exit 0; fi - echo "第 $i 次: $CODE, 等待中..."; sleep 3 + CODE=$(curl -s -o /dev/null -w "%{http_code}" http://blog.apps.svc.cluster.local/healthz || true) + if [ "$CODE" = "200" ]; then echo "健康检查通过 (第 $i 次)"; exit 0; fi + echo "第 $i 次: $CODE"; sleep 3 done echo "健康检查失败"; exit 1 '''