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

CPS failures from calls in @NonCPS blocks fail silently and marks as success

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • pipeline
    • None

      Run this pipeline script without a sandbox:

      node {
          noncps()
      }
      
      @NonCPS
      def noncps() {
          echo "Calling @NonCPS method System.currentTimeMillis(): ${System.currentTimeMillis()}"
          echo "Calling cps(): ${cps()}"
          echo "Calls completed"
      }
      
      def cps() {
          // should fail
          return System.currentTimeMillis()
      }
      

      Expected: fails in the call to cps(), or arguably succeeds and runs the whole pipeline.
      Actual: silently buries the exception and terminates the call to noncps(), but marks the job as a success.

      Example output:

      [Pipeline] node
      Running on XXXXXXX in XXXXXXX
      [Pipeline] {
      [Pipeline] echo
      Calling @NonCPS method System.currentTimeMillis(): 1476725898097
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

            Unassigned Unassigned
            zls1988 Zack Sampson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: