gpt4 book ai didi

jenkins - 如果作业失败三次或以上,如何禁用它?

转载 作者:行者123 更新时间:2023-12-02 18:36:43 25 4
gpt4 key购买 nike

如果某个作业失败了三次或更多次,我想禁用它。我发现this solution立即禁用它。但我想等三遍。

最佳答案

您可以从build.previousBuild获取之前的结果。例如:

def failingForAtLeast(build, n) {
def failed = build.result.isWorseThan(hudson.model.Result.SUCCESS );
if( n <= 1 ) {
return failed;
} else if ( failed && build.previousBuild != null) {
return failingForAtLeast(build.previousBuild, n-1);
} else {
return false;
}
}

if ( failingForAtLeast(manager.build, 3) ) {
manager.build.project.disabled = true
}

关于jenkins - 如果作业失败三次或以上,如何禁用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24785490/

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