parallel sh step with returnStatus: true causing build failure

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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

            Assignee:
            Unassigned
            Reporter:
            Ben Dean
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: