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

Collecting build job results using [.result] property returns null

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins ver. 2.140

      I would like to collect all triggered jobs results.
      My script looks like this:

      stage('Integration Tests') {
      	steps {
      		script {
      			def jobs = [:]
      			def childJob
      			def childJobName
      			pipelineIntegrationJobs.each {
      				i -> jobs["${nirvanaMajor}.${nirvanaMinor}_${i}"] = {
      					childJob = build (job: "${nirvanaMajor}.${nirvanaMinor}_${i}", 
      						parameters: [
      							string(name: 'branch', value: "${svnBranch}", description: 'svn repository url'), 
      							string(name: 'buildmajor', value: '10', description: 'release major identifier'),
      							string(name: 'buildminor', value: '4', description: 'release minor identifier'),
      							string(name: 'fix', value: "${env.fix}", description: 'fix level'), 
      							string(name: 'buildnumber', value: "${env.buildNumber}", description: 'artifacts build number'), 
      							string(name: 'revision', value: "${env.buildNumber}", description: 'checkout revision'),
      							string(name: 'joblabel', value: "${pipelineName}", description: "optional job description")
      						], quietPeriod: 0, propagate: false, wait: true).result
      				}
      				childJobName = "${nirvanaMajor}.${nirvanaMinor}_${i}"
      				results.put(childJobName, childJob)
      			}
      			parallel jobs
      		}
      	}	
      }
      

      In the post section of the pipeline I have this:

      script {
      	println "------------------------------------"
      	println "Job Status Summary:"
      	results.each{ k, v -> println "${k}:${v}" }
      	println "------------------------------------"
      }
      

      This yields properly the job names but not job statuses:

      12:22:41 Job Status Summary:
      [Pipeline] echo
      12:22:41 10.4_test_foundation_win:null
      [Pipeline] echo
      12:22:41 10.4_test_foundation_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_client_win:null
      [Pipeline] echo
      12:22:41 10.4_test_client_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_base_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_base_win:null
      [Pipeline] echo
      12:22:41 10.4_test_admin_api_win:null
      [Pipeline] echo
      12:22:41 10.4_test_admin_api_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_admin_api_cluster_win:null
      [Pipeline] echo
      12:22:41 10.4_test_admin_api_cluster_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_jms_win:null
      [Pipeline] echo
      12:22:41 10.4_test_jms_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_client_tool_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_client_tool_win:null
      [Pipeline] echo
      12:22:41 10.4_test_cluster_tool_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_cluster_tool_win:null
      [Pipeline] echo
      12:22:41 10.4_test_admin_tool_win:null
      [Pipeline] echo
      12:22:41 10.4_test_admin_tool_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_cpp_linux:null
      [Pipeline] echo
      12:22:41 10.4_test_cpp_win:null
      [Pipeline] echo
      12:22:41 10.4_test_cpp_osx:null
      
      

      Could this be because of [wait: true]? What is wrong?

      According to the documentation here: https://jenkins.io/doc/pipeline/steps/pipeline-build-step/ I should be able to collect the statuses exactly like this.

          [JENKINS-53923] Collecting build job results using [.result] property returns null

          Vassilena Treneva created issue -
          Vassilena Treneva made changes -
          Attachment New: pipelineBuilder.groovy [ 44710 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-build-step-plugin [ 21707 ]
          Component/s Original: job-dsl-plugin [ 16720 ]
          Component/s Original: pipeline [ 21692 ]
          Component/s Original: pipeline-model-definition-plugin [ 21706 ]
          Component/s Original: pipeline-stage-step-plugin [ 21709 ]
          Assignee Original: Daniel Spilker [ daspilker ]
          Vassilena Treneva made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Vassilena Treneva made changes -
          Assignee New: Andrew Bayer [ abayer ]
          Ovidiu-Florin Bogdan made changes -
          Description Original: I would like to collect all triggered jobs results.
          My script looks like this:

          stage('Integration Tests') {
          steps {
          script {
          def jobs = [:]
          def childJob
          def childJobName
          pipelineIntegrationJobs.each {
          i -> jobs["${nirvanaMajor}.${nirvanaMinor}_${i}"] = {
          childJob = build (job: "${nirvanaMajor}.${nirvanaMinor}_${i}",
          parameters: [
          string(name: 'branch', value: "${svnBranch}", description: 'svn repository url'),
          string(name: 'buildmajor', value: '10', description: 'release major identifier'),
          string(name: 'buildminor', value: '4', description: 'release minor identifier'),
          string(name: 'fix', value: "${env.fix}", description: 'fix level'),
          string(name: 'buildnumber', value: "${env.buildNumber}", description: 'artifacts build number'),
          string(name: 'revision', value: "${env.buildNumber}", description: 'checkout revision'),
          string(name: 'joblabel', value: "${pipelineName}", description: "optional job description")
          ], quietPeriod: 0, propagate: false, wait: true).result
          }
          childJobName = "${nirvanaMajor}.${nirvanaMinor}_${i}"
          results.put(childJobName, childJob)
          }
          parallel jobs
          }
          }
          }


          In the post section of the pipeline I have this:

          script {
          println "------------------------------------"
          println "Job Status Summary:"
          results.each{ k, v -> println "${k}:${v}" }
          println "------------------------------------"
          }

          This yields properly the job names but not job statuses:

          12:22:41 Job Status Summary:
          [Pipeline] echo
          12:22:41 10.4_test_foundation_win:null
          [Pipeline] echo
          12:22:41 10.4_test_foundation_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_client_win:null
          [Pipeline] echo
          12:22:41 10.4_test_client_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_base_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_base_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_cluster_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_cluster_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_jms_win:null
          [Pipeline] echo
          12:22:41 10.4_test_jms_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_client_tool_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_client_tool_win:null
          [Pipeline] echo
          12:22:41 10.4_test_cluster_tool_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_cluster_tool_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_tool_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_tool_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_cpp_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_cpp_win:null
          [Pipeline] echo
          12:22:41 10.4_test_cpp_osx:null


          Could this be because of [wait: true]? What is wrong?

          According to the documentation here: https://jenkins.io/doc/pipeline/steps/pipeline-build-step/ I should be able to collect the statuses exactly like this.
          New: I would like to collect all triggered jobs results.
          My script looks like this:


          {code:groovy}
          stage('Integration Tests') {
          steps {
          script {
          def jobs = [:]
          def childJob
          def childJobName
          pipelineIntegrationJobs.each {
          i -> jobs["${nirvanaMajor}.${nirvanaMinor}_${i}"] = {
          childJob = build (job: "${nirvanaMajor}.${nirvanaMinor}_${i}",
          parameters: [
          string(name: 'branch', value: "${svnBranch}", description: 'svn repository url'),
          string(name: 'buildmajor', value: '10', description: 'release major identifier'),
          string(name: 'buildminor', value: '4', description: 'release minor identifier'),
          string(name: 'fix', value: "${env.fix}", description: 'fix level'),
          string(name: 'buildnumber', value: "${env.buildNumber}", description: 'artifacts build number'),
          string(name: 'revision', value: "${env.buildNumber}", description: 'checkout revision'),
          string(name: 'joblabel', value: "${pipelineName}", description: "optional job description")
          ], quietPeriod: 0, propagate: false, wait: true).result
          }
          childJobName = "${nirvanaMajor}.${nirvanaMinor}_${i}"
          results.put(childJobName, childJob)
          }
          parallel jobs
          }
          }
          }
          {code}



          In the post section of the pipeline I have this:


          {code:groovy}
          script {
          println "------------------------------------"
          println "Job Status Summary:"
          results.each{ k, v -> println "${k}:${v}" }
          println "------------------------------------"
          }
          {code}


          This yields properly the job names but not job statuses:


          {noformat}
          12:22:41 Job Status Summary:
          [Pipeline] echo
          12:22:41 10.4_test_foundation_win:null
          [Pipeline] echo
          12:22:41 10.4_test_foundation_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_client_win:null
          [Pipeline] echo
          12:22:41 10.4_test_client_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_base_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_base_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_cluster_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_api_cluster_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_jms_win:null
          [Pipeline] echo
          12:22:41 10.4_test_jms_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_client_tool_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_client_tool_win:null
          [Pipeline] echo
          12:22:41 10.4_test_cluster_tool_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_cluster_tool_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_tool_win:null
          [Pipeline] echo
          12:22:41 10.4_test_admin_tool_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_cpp_linux:null
          [Pipeline] echo
          12:22:41 10.4_test_cpp_win:null
          [Pipeline] echo
          12:22:41 10.4_test_cpp_osx:null

          {noformat}


          Could this be because of [wait: true]? What is wrong?

          According to the documentation here: https://jenkins.io/doc/pipeline/steps/pipeline-build-step/ I should be able to collect the statuses exactly like this.
          Markus Kurde made changes -
          Assignee Original: Andrew Bayer [ abayer ] New: Markus Kurde [ mkurde ]

          Markus Kurde added a comment -

          This is not a bug, this is a feature.

          See the comments in this Task:  JENKINS-48475

          Markus Kurde added a comment - This is not a bug, this is a feature. See the comments in this Task:   JENKINS-48475
          Markus Kurde made changes -
          Link New: This issue relates to JENKINS-48475 [ JENKINS-48475 ]

            mkurde Markus Kurde
            vassilena Vassilena Treneva
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: