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

failFast has no effect when withCredentials is used

    Details

    • Similar Issues:

      Description

      When wrapping a long-running step inside a parallel branch in withCredentials, failFast will no longer result in the long-running branch being terminated. I'll use the failFast example at https://github.com/kmadel/jenkins-workflow-examples/blob/master/failFast.groovy:

      This works
      stage 'parallel with failFast'
      def error;
      node {
        try {
          parallel(
            b: { error 'died' },
            // make sure this branch takes longer than b
            a: { sleep 35; writeFile text: '', file: 'a.done' },
            failFast: true
          )
        } catch (e) {
          error = e.toString()
        }
      }
      stage 'failFast Success with error'
      echo "error: ${error}"
      

      That works fine. However, if I try to use withCredentials, the longer-running a branch continues normal execution, and the build only fails once it's done:

      This doesn't work
      stage 'parallel with failFast'
      def error;
      node {
        try {
          parallel(
            b: { error 'died' },
            // make sure this branch takes longer than b
            a: { withCredentials([[$class: 'StringBinding', credentialsId: 'some-credentials-id-here', variable: 'SOME_ENV_VARIABLE']]) {
              sleep 35
              writeFile text: '', file: 'a.done'
            } },
            failFast: true
          )
        } catch (e) {
          error = e.toString()
        }
      }
      stage 'failFast Success with error'
      echo "error: ${error}"
      

      Any ideas what's going on here, or thoughts on a workaround?

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            No idea offhand, would have to see if reproducible in a functional test.

            Show
            jglick Jesse Glick added a comment - No idea offhand, would have to see if reproducible in a functional test.
            Hide
            jglick Jesse Glick added a comment -

            Probably the same as JENKINS-34637, so please retest with that update and reopen if the problem persists.

            Show
            jglick Jesse Glick added a comment - Probably the same as JENKINS-34637 , so please retest with that update and reopen if the problem persists.

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                wilkystyle Mike Wilkerson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: