简体   繁体   中英

sporadic issue with jenkins email-ext plugin

I have email notifications set up in a jenkins pipeline job using email-ext (v2.57.2). The emails are sent fine for the first couple of iterations but then after about 4th execution, the following error occurs (and continues happening for all the subsequent runs):

> [Pipeline] emailext messageContentType = text/html; charset=UTF-8
> Adding recipients from project recipient list Adding recipients from
> trigger recipient list Successfully created MimeMessage An attempt to
> send an e-mail to empty list of recipients, ignored. Some error
> occured trying to send the email...check the Jenkins log

Not quite sure which Jenkins log to look at...

Figured out that it had to do with the use of $class: "RequesterRecipientProvider. When a job runs in a scheduled fashion, this value comes up as null. Only when the job is run manually is it populated.

Ended up switching the Jenkinsfile over to use a jenkins environment variable.

def emailRecipients = "${env.EMAIL_RECIPIENTS}";
emailext (subject: subject, body: details, to: emailRecipients)

Another potential cause for this issue is having the shallow clone option enabled in the Advanced clone behaviours of a multibranch pipeline job. With this option most if not all of the emailext recipient providers may come up empty, even when a job has been triggered by a commit that broke the build.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM