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

parallel sh step with returnStatus: true causing build failure

    Details

    • Similar Issues:

      Description

      This is maybe related to https://issues.jenkins-ci.org/browse/JENKINS-28822

      I have a fairly complicated build that has parallel sections where sh steps run with returnStatus: true. Some of the parallel branches have timeout steps, others do not, but none of the timeouts are around the sh steps, they're usually around an input step.

      You could say that the pipeline looks something like this:

      stage('build') {
          parallel([
              foo: {
                  node {
                      def status = sh(returnStatus: true, script: 'exit 2')
                      if (status == 2) {
                          timeout(time: 10, unit: 'DAYS') {
                              input 'continue?'
                          }
                      }
                  }
              },
              bar: {
                  node {
                      def status = sh(returnStatus: true, script: 'exit 2')
                      if (status == 2) {
                          timeout(time: 10, unit: 'DAYS') {
                              input 'continue?'
                          }
                      }
                  }
              }
          ])
      }
      

      And the error I'm getting is only on one of those branches, the sh step fails with:

      script apparently exited with code 2 but asynchronous notification was lost
      

      Which seems to come from this line in the durable-task plugin:
      https://github.com/jenkinsci/workflow-durable-task-step-plugin/blob/workflow-durable-task-step-2.26/src/main/java/org/jenkinsci/plugins/workflow/steps/durable_task/DurableTaskStep.java#L461

      I'm not sure what I should be doing differently or how to workaround this, other than to not use returnStatus: true and instead just make these scripts write the status to a file in the workspace which I can read and always exit 0

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              Unassigned
              Reporter:
              b_dean Ben Dean
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: