Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39155

Only first label in list works correctly in parallel pipeline call

XMLWordPrintable

      Today we updated our plugins to the latest available. This included updating Pipeline API from 2.4 -> 2.5 and Pipleline Groovy 2.19 -> 2.20

      After we did that, our parallel builds began failing. We have a series of builds that run exactly the same function on several different label's nodes. Only the first action in the list of items submitted to Parallel works – all of the others result in these errors:

      [centos5x32] Failed in branch centos5x32
      [centos5] Failed in branch centos5
      [macosx1010] Failed in branch macosx1010

      The first item in the generated list runs fine – all others in the parallel fail with the "Failed in branch"

      Here is the code that sets up the parallel

      def nodeNames = ['windows10', 'centos5x32', 'centos5', 'macosx10.10'] // labels for Jenkins node types we will build on
      
      def builders = [:]
      for (x in nodeNames) {
          def label = x 
      
          // Create a map to pass in to the 'parallel' step so we can fire all the builds at once
          builders[label] = {
              node(label) {
                  commonBuild(label)
              }
          }
      }
      
      try {
      	stage ('Parallel Build') {
      		parallel builders
      	}
      } catch(e) {
      	currentBuild.result = "FAILED"
      	throw e
      } 
      

      Again, this build ran fine right before the plugins were updated, and failed after. Putting this within a method, and then marking that method as @NonCPS seemed to help – it a least allowed all 4 nodes to start in parallel.

            Unassigned Unassigned
            gregcovertsmith Greg Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: