如果最新版本未通过构建

时间:2016-07-28 15:41:11

标签: github jenkins jenkins-plugins gitlab

我正在运行一个Jenkins作业,当将更改推送到master时会自动构建。

但是,如果最新提交未通过构建,我想重新运行作业,旧版本是稳定的。

我如何在Jenkins中实现这一目标。

我可以使用Jenkins URL获取最新稳定版本,但下一步是什么?

1 个答案:

答案 0 :(得分:0)

如果您使用构建流程插件(或pipleline),那么此解决方案将适合您。

构建流程dsl脚本示例如下

def buildInstance
//Ingore the failure here to avoid flow stop
ignore(FAILURE){
    buildInstance = build("normal_git_job")
}

//Something goes wrong, try build another job
if (buildInstance.result.equals(FAILURE)){
    build("special_git_job")
}
相关问题