Programmatically access children builds in Jenkins build flow

Viewed 2637

I have a build flow pipeline (https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin) setup in Jenkins that spawns two or more children jobs each of which runs Junit tests.

def childjobs = []

// some logic to populate the children jobs array

// Run the jobs in parallel
parallel(childjobs)

I am trying to write a Groovy script in the context of the parent job using the Jenkins API to send a summary email from the parent job by collecting the summaries from the children.

How can I access the build information (success/failure, how many failures, duration, Junit results etc.) of the children jobs from the parent job? Conceptually something like this:

for (AbstractBuild<?,?> childjob in childjobs) {
    // get build info from childjob
    // get Junit results from childjob
}
1 Answers
Related