This commit is contained in:
dxin
2025-11-13 11:59:04 +08:00
parent 1298fdd1e8
commit a7c7be8452
17 changed files with 1856 additions and 235 deletions

View File

@@ -175,10 +175,13 @@ pipeline {
steps {
echo "检测部署状态并验证新版本运行情况"
sh """
set +e
echo "=== 检查 Deployment 滚动更新状态 ==="
kubectl rollout status deployment/${Deployment_name} -n ${K8s_namespace} --timeout=180s
ROLLOUT_RESULT=\$?
if [ \$? -ne 0 ]; then
if [ \$ROLLOUT_RESULT -ne 0 ]; then
echo "❌ 部署超时或失败,开始收集诊断信息..."
echo "=== 查看当前 Pods 状态 ==="
kubectl get pods -l app=${Pod_container_name} -n ${K8s_namespace} -o wide
@@ -272,7 +275,7 @@ pipeline {
}
success {
// 输出构建结果
echo "镜像构建成功!"
echo "部署成功!"
echo "镜像地址:${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_TAG}"
echo "对应代码提交:${GIT_COMMIT_SHORT}${GIT_COMMIT_MSG}"
}