From beabec5fb39ae8e48b00fff9ce9a327c94138329 Mon Sep 17 00:00:00 2001 From: lzh Date: Tue, 13 Jan 2026 15:13:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=AE=BF=E4=B8=BB?= =?UTF-8?q?=E6=9C=BA=20SSH=20=E5=9C=B0=E5=9D=80=E4=B8=BA=20172.19.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Jenkins 容器在 1panel-network 网络中 - 网关地址是 172.19.0.1 而不是 172.17.0.1 - Jenkins 负责指挥,实际部署在宿主机执行 --- Jenkinsfile | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 53539ab..33904fa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -183,17 +183,22 @@ pipeline { services.each { service -> echo "Deploying ${service}..." - // 使用明确的命令格式 + // 通过 SSH 在宿主机上执行部署命令 + // Jenkins 容器网络: 1panel-network, Gateway: 172.19.0.1 sh """ - cd /opt/aiot-platform-cloud - /usr/bin/docker compose -f docker-compose.core.yml pull ${service} - /usr/bin/docker compose -f docker-compose.core.yml up -d ${service} + ssh -o StrictHostKeyChecking=no root@172.19.0.1 ' + cd /opt/aiot-platform-cloud + docker compose -f docker-compose.core.yml pull ${service} + docker compose -f docker-compose.core.yml up -d ${service} + ' """ // 等待服务健康检查 echo "Waiting for ${service} to be healthy..." sh """ - timeout 120 sh -c 'until docker inspect --format="{{.State.Health.Status}}" aiot-${service} 2>/dev/null | grep -q healthy; do sleep 5; done' || true + ssh -o StrictHostKeyChecking=no root@172.19.0.1 ' + timeout 120 sh -c "until docker inspect --format=\\"{{.State.Health.Status}}\\" aiot-${service} 2>/dev/null | grep -q healthy; do sleep 5; done" || true + ' """ }