-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins 2.89.2, email-ext-plugin 2.61
With a method calling emailextrecipients() annotated by NonCPS, nothing is executed after that emailextrecipients() call. Example pipeline script and its output below:
node("master") { mail() } @NonCPS void mail() { def to = emailextrecipients([[$class: 'RequesterRecipientProvider']]) echo "Recipients: ${to}" if (to != null && !to.isEmpty()) { emailext to: to, replyTo: "\$DEFAULT_REPLYTO", subject: "\$DEFAULT_SUBJECT", body: "\$DEFAULT_CONTENT" } }
[Pipeline] node Running on Jenkins in /var/lib/jenkins/jobs/Test-Workflow/workspace [Pipeline] { [Pipeline] emailextrecipients [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
Without NonCPS the output is:
[Pipeline] node Running on Jenkins in /var/lib/jenkins/jobs/Test-Workflow/workspace [Pipeline] { [Pipeline] emailextrecipients [Pipeline] echo Recipients: atikhonova@parallels.com [Pipeline] emailext Sending email to: atikhonova@parallels.com [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline Finished: SUCCESS
from https://github.com/jenkinsci/workflow-cps-plugin/blob/master/README.md#technical-design
@NonCPS methods may safely use non-Serializable objects as local variables, though they should not accept nonserializable parameters or return or store nonserializable values. You may not call regular (CPS-transformed) methods, or Pipeline steps, from a @NonCPS method