2

我想在 Jenkins 作业中运行预构建步骤 shell/perl,并且在某些条件下,我希望它跳过其余的作业,但仍使其成功。有没有办法做到这一点?

谢谢你的时间。

4

1 回答 1

2

我使用通过Groovy 插件运行的系统 Groovy 脚本构建步骤来完成:

def thr = Thread.currentThread()
def thisBuild = thr?.executable

thisBuild.setResult(hudson.model.Result.SUCCESS)
thisBuild.executor.interrupt(hudson.model.Result.SUCCESS)

警告:某些插件(最突出的是运行条件插件)不能优雅地处理“中断构建”(尽管据我所知,它们必须这样做)并且如果构建步骤“属于”它们在该代码之后运行,那么构建将失败。

于 2012-05-25T04:46:11.863 回答