fix: 修正宿主机 SSH 地址为 172.19.0.1
Some checks failed
Java CI with Maven / build (11) (push) Has been cancelled
Java CI with Maven / build (17) (push) Has been cancelled
Java CI with Maven / build (8) (push) Has been cancelled

- Jenkins 容器在 1panel-network 网络中
- 网关地址是 172.19.0.1 而不是 172.17.0.1
- Jenkins 负责指挥,实际部署在宿主机执行
This commit is contained in:
lzh
2026-01-13 15:13:49 +08:00
parent 27d3cc4b94
commit beabec5fb3

15
Jenkinsfile vendored
View File

@@ -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
'
"""
}