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

noncps function is silently aborted

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The function annotated with @NonCPS in the attached Jenkinsfile is not executed completely. There is no report about that. If it is not allowed to call e.g. 'sh' in a NonCPS context than i would at least expect to get an Exception. But silently not executing parts of the test-code is really bad.

      If the pipeline will be extended, that it returns some Integer value, the return value is null in the caller.

      This is a snippet from the attached pipeline

      steps
      {
       println('call cps')
       cps() println('call non-cps')
       non_cps()
       println('exit pipeline') 
      }
      

       

      The cps and non_cps functions are the same, but with different println and the non_cps is annoted with @NonCPS:

      *cps()
      {
         println("enter cps")
         sh "ls"
         println("exit cps") 
      }
      

      And this is the relevant part of the build log

      00:00:05.956 call cps[Pipeline] echo

      00:00:06.621 cps - enter[Pipeline] sh

      00:00:07.032 [workspace@2] Running shell script*

      00:00:07.288* + ls[Pipeline] echo

      00:00:07.730 cps - exit[Pipeline] echo

      00:00:08.052 call non-cps[Pipeline] echo

      00:00:08.640 non_cps - enter[Pipeline] sh

      00:00:09.007 [workspace@2] Running shell script*

      00:00:09.263* + ls[Pipeline] echo


      the non_cpx exit print is missing here!

       

      00:00:09.782 exit pipeline

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            manut Manuel Traut
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated: