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

Parallel Build job propagates FAIL while running when child job UNSTABLE

XMLWordPrintable

      I have two Jenkins jobs, a parent job that triggers a child job with different configurations and runs these stages in parallel. When a child job has an UNSTABLE state, the parent job reports this stage as failed as long as the parent job is still running. When the parent job is finished all results are propagated as expected.

      Example to reproduce:

      // Parent job
      // With three stages with SUCCESS, UNSTABLE and FAILED stages
      
      node('<label>'){
          def stage_map = [:]
          stage_map['success'] = trigger('SUCCESS')
          stage_map['unstable'] = trigger('UNSTABLE')
          stage_map['failed'] = trigger('FAILED')
          stage_map['sleep'] = trigger('SUCCESS', true)
          
          parallel(stage_map)
      }
      
      def trigger(status, sleep = false){
          return {
              build job:
                  'test_child',
                  parameters: [
                          string(name: 'status', value: status),
                          booleanParam(name: 'sleep', value: sleep)
                      ]
          }
      }
      
      // Child Job
      // Sleep parameter to better observe behavior
      
      node('<label>'){
            properties(
          [
              parameters(
                  [       string(name: 'status', defaultValue: 'SUCCESS'),
                          booleanParam(name: 'sleep', defaultValue: true)]
                  )    ]
          ) 
          def t = params.sleep ? 30 : 1
          sleep(time: t, unit: 'SECONDS')
          currentBuild.result = params.status
      }
      

      Possibly related to JENKINS-49073

        1. after_run.png
          45 kB
          Philipp Jung
        2. during_run.png
          43 kB
          Philipp Jung

            Unassigned Unassigned
            pjung Philipp Jung
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: