-
Bug
-
Resolution: Unresolved
-
Critical
-
Jenkins ver. 2.121.2 with up-to-date plugins
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