user2477951
user2477951

Reputation: 21

how to get in Build Flow Plugin the result of the executed/triggered job

I am executing a job using Build Flow plugin. like b = build ("JOB1"); 1) how can get the JOB1 build status like PASS or FAIL and depending upon that result I want execute the JOB2. like, not the correct syntax

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

like this i want to do please can suggest a plugin or using BUildFlow how to get the build state of the Job.

Upvotes: 2

Views: 2153

Answers (1)

cursed_axes
cursed_axes

Reputation: 1783

Found this(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()))
}

Hope this helps

Found this from here (http://delivervalue.blogspot.in/2013/06/more-advanced-build-flows-with-jenkins.html)

def results = build("ComponentName")
println results.build.result.toString()

Upvotes: 3

Related Questions