我正在使用Build Flow插件执行作业。 喜欢 b = build(" JOB1"); 1)如何获得JOB1构建状态,如PASS或FAIL,并根据该结果,我想执行JOB2。 喜欢, 不正确的语法
if(b.result == PASS) {
build("JOB2")
}
else
{
build("JOB3");
}
像这样我想做的请建议插件或使用BUildFlow如何获得作业的构建状态。
答案 0 :(得分: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()