fix: expose failed deployment container logs
This commit is contained in:
@@ -273,6 +273,13 @@ deploy_local() {
|
||||
fi
|
||||
|
||||
echo "新镜像健康检查失败: $IMAGE" >&2
|
||||
failed_container_id="$(local_container_id || true)"
|
||||
if [ -n "$failed_container_id" ]; then
|
||||
echo "新镜像容器最近日志(最多 200 行):" >&2
|
||||
docker logs --tail 200 "$failed_container_id" 2>&1 || true
|
||||
else
|
||||
echo "新镜像容器不存在,无法读取启动日志" >&2
|
||||
fi
|
||||
expected_prefix="$IMAGE_REPOSITORY/$SERVICE:"
|
||||
case "$previous_image" in
|
||||
"$expected_prefix"*)
|
||||
@@ -476,6 +483,13 @@ if [ "$new_started" = "true" ] && wait_for_health; then
|
||||
fi
|
||||
|
||||
echo "新镜像健康检查失败: $new_image" >&2
|
||||
failed_container_id="$(remote_container_id || true)"
|
||||
if [ -n "$failed_container_id" ]; then
|
||||
echo "新镜像容器最近日志(最多 200 行):" >&2
|
||||
docker logs --tail 200 "$failed_container_id" 2>&1 || true
|
||||
else
|
||||
echo "新镜像容器不存在,无法读取启动日志" >&2
|
||||
fi
|
||||
expected_prefix="$image_repository/$service:"
|
||||
case "$previous_image" in
|
||||
"$expected_prefix"*) previous_tag="${previous_image#"$expected_prefix"}" ;;
|
||||
|
||||
Reference in New Issue
Block a user