gpt4 book ai didi

Jenkins 构建失败,但所有阶段都成功

转载 作者:行者123 更新时间:2023-12-04 04:23:54 28 4
gpt4 key购买 nike

我有一个 Jenkins 管道,所有阶段都完成并报告为成功,但整体构建被标记为失败。每次运行构建时都会发生这种情况。构建从头到尾运行,没有任何“从最后一个阶段继续”。 jenkins 版本和插件都更新为最新版本。

如果我查看每个阶段,它会在悬停中显示“成功”(见截图)。

我在这里缺少什么?

My Jenkinsfile
enter image description here
enter image description here

编辑 1:添加蓝海截图:
enter image description here

管道日志文件的结尾:

[Pipeline] }
[Pipeline] // withEnv
Post stage
[Pipeline] junit
Recording test results
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] mail
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: FAILURE

编辑 2:添加帖子部分

这是管道语句的结尾:
post {
failure {
mail to: "$MAIL_NOTIFY",
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}

编辑 3:删除帖子失败

如果我删除“post { failure { mail ... } }”部分,则构建成功完成。所以现在的问题是......我如何修复这个部分才能正常工作?

最佳答案

由于发送电子邮件步骤失败,您可以尝试使用:

environment {
EMAIL_TO = 'someone@host.com'
}
post {
failure {
emailext body: 'Check console output at $BUILD_URL to view the results. \n\n ${CHANGES} \n\n -------------------------------------------------- \n${BUILD_LOG, maxLines=100, escapeHtml=false}',
to: EMAIL_TO,
subject: 'Build failed in Jenkins: $PROJECT_NAME - #$BUILD_NUMBER'
}

}

关于 Jenkins 构建失败,但所有阶段都成功,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58346495/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com