File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -101,17 +101,26 @@ jobs:
101101 sudo systemctl daemon-reload
102102 sudo systemctl restart tinyflow
103103
104- # 等待服务启动
105- sleep 3
104+ # 等待服务启动(Spring Boot 应用启动较慢,需要更长时间)
105+ echo "⏳ 等待服务启动..."
106+ sleep 10
106107
107- # 健康检查
108- if curl -f http://localhost:8080/actuator/health > /dev/null 2>&1; then
109- echo "✅ 部署完成!服务已启动"
110- else
111- echo "❌ 服务启动失败,请检查日志"
112- journalctl -u tinyflow -n 50
113- exit 1
114- fi
108+ # 健康检查(重试机制)
109+ MAX_RETRY=12
110+ RETRY_COUNT=0
111+ while [ $RETRY_COUNT -lt $MAX_RETRY ]; do
112+ if curl -f http://localhost:8080/actuator/health > /dev/null 2>&1; then
113+ echo "✅ 部署完成!服务已启动"
114+ exit 0
115+ fi
116+ RETRY_COUNT=$((RETRY_COUNT+1))
117+ echo "⏳ 第 $RETRY_COUNT 次检查失败,等待 10 秒后重试..."
118+ sleep 10
119+ done
120+
121+ echo "❌ 服务启动超时,请检查日志"
122+ journalctl -u tinyflow -n 100
123+ exit 1
115124
116125 # 8. 部署失败通知(可选)
117126 - name : Deployment Failed
You can’t perform that action at this time.
0 commit comments