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

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

XMLWordPrintable

    • 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.

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

              Created:
              Updated: