2

我正在使用 Build Flow 插件执行一项工作。像 b = build ("JOB1"); 1)如何获得JOB1构建状态,如PASS或FAIL,取决于我想要执行JOB2的结果。喜欢,不是正确的语法

if(b.result == PASS) {
    build("JOB2")
}
else 
{
    build("JOB3");
}

像这样我想做的请可以建议一个插件或使用 BUildFlow 如何获取作业的构建状态。

4

1 回答 1

3

找到这个(https://groups.google.com/forum/#!topic/jenkinsci-dev/tWfVfWInaP4),

builds = []
ignore(FAILURE) {
    parallel (
       {builds.add(build("foo1", COPY_PATH: params["bar"]))},
       {builds.add(build("foo2", COPY_PATH: params["bar"]))},
       {builds.add(build("foo3", COPY_PATH: params["bar"]))},
    )
}
for (b in builds) {
    out.println "Finished Build : " + hudson.console.HyperlinkNote.encodeTo("/"    + b.getUrl(), String.valueOf(b.getDisplayName())) 
    + " of Job : " + hudson.console.HyperlinkNote.encodeTo('/' + b.getProject().getUrl(), b.getProject().getFullName()) 
    + " with status :" +  hudson.console.HyperlinkNote.encodeTo('/' + b.getUrl() + "console", b.getResult().toString())
    build.setResult(build.getResult().combine(b.getResult()))
}

希望这可以帮助

从这里找到这个(http://delivervalue.blogspot.in/2013/06/more-advanced-build-flows-with-jenkins.html

def results = build("ComponentName")
println results.build.result.toString()
于 2015-09-16T04:21:58.290 回答