简体   繁体   中英

how to get parallel build job result in jenkins

My Jenkins job run multiple builds in parallel as below:

def branches = [:]


for (int i = 0; i < 4; i++) {
  def index = i 
  branches["branch${i}"] = {
    build job: 'Test', parameters: [
      string(name: 'param1', value:'test_param'),
      string(name:'dummy', value: "${index}")]
  }
}
parallel branches

For the above code I want to print all build result. So how can I get build result (eg SUCCESS , FAILURE ...) of all parallel jobs?

If you want to print all branches result in the same console you can do it like this

def branches = [:]
for (int i = 0; i < 4; i++) {
 def index = i 
  branches["branch${i}"] = {
  build job: 'Test', parameters: [
  string(name: 'param1', value:'test_param'),
  string(name:'dummy', value: "${index}")]
 }
  println currentBuild.result
}
parallel branches

currentBuild.result holds status of the build so if you print it in each branch you will get what you need. If the stage

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM