我使用email-ext(v2.57.2)在jenkins管道作业中设置了电子邮件通知。电子邮件在前几次迭代中发送正常,但在第4次执行后,发生以下错误(并继续发生所有后续运行):
> [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
不太确定Jenkins会记录哪些内容......
答案 0 :(得分:0)
想出它与$ class的使用有关:“RequesterRecipientProvider。当一个作业以预定的方式运行时,这个值会变为null。只有在手动运行作业时才填充它。
结束切换Jenkins文件以使用jenkins环境变量。
def emailRecipients = "${env.EMAIL_RECIPIENTS}";
emailext (subject: subject, body: details, to: emailRecipients)
答案 1 :(得分:0)
此问题的另一个潜在原因是在多分支管道作业的高级克隆行为中启用了浅克隆选项。使用此选项时,即使不是所有 emailext
收件人提供程序也可能会出现空的情况,即使作业已由破坏构建的提交触发。