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

pipeline will hang use wait=true during call other job in a loop

XMLWordPrintable

      Following is pipeline code

       

      @NonCPS
      def fn(){
      def parallelArgs = [:]
      new File('/home/jenkins/workspace/test_post_for_pipeline').eachFile() {
      file ->
      if (file.getName().endsWith('.properties')) {
      parallelArgs["Run: $\{file.getName()}"] = {
      build job: 'test', wait: true, parameters: [string(name: 'IN_PARAM_1', value: file.getAbsolutePath()), string(name: 'IN_PARAM_2', value: '2'), string(name: 'IN_PARAM_3', value: '3')]

      }
      }
      }
      parallel(parallelArgs)
      }

      node('master'){
      fn()
      }

       

      Result: the build will hang forever. even downstream job test build done 
      Started by user
      Shuaibing Li
      Replayed
      [#121

      https://jenkins-c.lombardrisk.com/job/test_post_for_pipeline/121/]
      [Pipeline] node
      Running on
      Jenkins
      in /home/jenkins/workspace/test_post_for_pipeline
      [Pipeline] {
      [Pipeline] parallel
      [Pipeline] [Run: a.properties] { (Branch: Run: a.properties)
      [Pipeline] [Run: a.properties] build (Building test)
      [Run: a.properties] Scheduling project:
      [test
      https://jenkins-c.lombardrisk.com/job/test/]
      [Pipeline] [Run: b.properties] { (Branch: Run: b.properties)
      [Pipeline] [Run: a.properties] build (Building test)
      [Run: a.properties] Scheduling project:
      [test
      https://jenkins-c.lombardrisk.com/job/test/]
      [Run: a.properties] Starting building:
      test #313

            Unassigned Unassigned
            lsbwant lsb want
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: