gpt4 book ai didi

jenkins - 声明性管道: don't send post/failure notifications if build was aborted

转载 作者:行者123 更新时间:2023-12-02 15:29:12 27 4
gpt4 key购买 nike

我正在尝试设置有关声明性管道失败的通知,如下所述:
https://jenkins.io/doc/pipeline/tour/post/

post {
failure {
emailext (
subject: "FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]'",
body: """<p>FAILED: Job '${env.JOB_NAME} [${env.BUILD_NUMBER}]':</p>
<p>Check console output at &QUOT;<a href='${env.BUILD_URL}'>${env.JOB_NAME} [${env.BUILD_NUMBER}]</a>&QUOT;</p>""",
recipientProviders: [[$class: 'CulpritsRecipientProvider']]
)
}
}
}

如果构建中止,是否有办法不发送电子邮件?

在“旧”脚本化管道中,我捕获了 FlowInterruptedException 来实现此目的。

catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
echo "the job was cancelled or aborted"
currentBuild.result = 'ABORTED'
}

最佳答案

此问题已由 https://issues.jenkins-ci.org/browse/JENKINS-43339 修复有一个错误将 currentBuild.result 设置为 FAILURE 而不是 ABORTED。

更新后请务必重新启动jenkins。

关于jenkins - 声明性管道: don't send post/failure notifications if build was aborted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42973501/

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