Programmatic access to children's assemblies in the Jenkins assembly thread

I have a build stream pipeline ( https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin ) in Jenkins that spawns two or more child 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 a parent task, using the Jenkins API to send an email summary from a parent task, collecting summaries from children.

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

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

, API Build Flow Jenkins, , , :

import hudson.model.*
import groovy.json.*

// Assign a variable to the flow run
def flow = parallel(
  {build("child-dummy", branch_name: "child1")},
  {build("child-dummy", branch_name: "child2")}
)

println 'Main flow ' + flow.getClass().toString() + ', size: ' + flow.size()
flow.each { it ->                                           // type = com.cloudbees.plugins.flow.FlowState  
  def jobInvocation = it.getLastBuild()                     // type = com.cloudbees.plugins.flow.JobInvocation
  println 'Build number #' + jobInvocation.getNumber()  
  println 'Build URL ' + jobInvocation.getBuildUrl()
}

, .. , jobInvocation.getBuild(), Run.

Junit JSON, , Jenkins JUnit XML- - script?.

0

All Articles