From ec427dd19ab4360ed4afb13b219fa894b4cc2174 Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Sun, 27 Jul 2025 20:33:47 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=8A=A0=E5=85=A5=E5=81=A5?= =?UTF-8?q?=E5=BA=B7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 82d9fd7..eb824e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,6 +52,7 @@ pipeline { sh ''' docker rm -f $CONTAINER_NAME || true docker run -d --name $CONTAINER_NAME \\ + --network mysql_default \\ -p $HOST_PORT:$CONTAINER_PORT \\ --health-cmd="curl -f http://localhost:80 || exit 1" \\ --health-interval=5s \\ @@ -65,21 +66,24 @@ pipeline { agent any steps { script { + def lastStatus = '' timeout(time: 60, unit: 'SECONDS') { waitUntil { def status = sh( - script: "docker inspect -f '{{.State.Health.Status}}' $CONTAINER_NAME || echo 'no-healthcheck'", - returnStdout: true - ).trim() - echo "Current container status: ${status}" - return (status == 'healthy') + script: "docker inspect -f '{{.State.Health.Status}}' $CONTAINER_NAME || echo 'no-healthcheck'", + returnStdout: true + ).trim() + + if (status != lastStatus) { + echo "Container health: ${status}" + lastStatus = status + } + + return (status == 'healthy') + } + } } } } } } - - - - } -}