简体   繁体   English

jenkins管道中的receiveProviders始终为空

[英]recipientProviders in jenkins pipeline are always empty

after finishing a job I want to send email notification. 完成工作后,我想发送电子邮件通知。 If the job is triggered manually at least RequesterRecipientProvider if filled with the user who triggered the build. 如果作业是手动触发的,则至少由触发构建的用户填充RequesterRecipientProvider I triggered from gitlab push webhook there is no email address configured in any of the recipientProviders. 我从gitlab push webhook触发,在任何accepterProviders中都没有配置电子邮件地址。

    emailext (
      mimeType: 'text/html',
      replyTo: '$DEFAULT_REPLYTO', 
      subject: subject,
      body: details,
      to: requester,
      recipientProviders: [[$class: 'CulpritsRecipientProvider'],
                         [$class: 'RequesterRecipientProvider'],
                         [$class: 'DevelopersRecipientProvider'],
                         [$class: 'FailingTestSuspectsRecipientProvider'             ], 
                         [$class: 'FirstFailingBuildSuspectsRecipientProvider']
                        ]
        )

Any idea when those recipientProvider get filled? 这些接收者填充时知道吗? Where does email-ext get the recipient list from? email-ext从哪里获得收件人列表?

I've been banging my head with this for the last couple of days and i think i figured it out: 在过去的几天里,我一直在用这种方法来敲打我的头,我想我已经明白了:

How it worked(for me): 运作方式(对我而言):

First - In jenkins.co/configure check all the triggers for email ext plugin and fill in some emails in the default recipients input separated by a single space 首先-在jenkins.co/configure中检查电子邮件扩展插件的所有触发器,并在默认收件人输入中填充一些电子邮件,并用单个空格分隔

Second- In the pipeline place the email ext code snippet just before closing the pipeline inside post brackets as follow 第二-在管道中将电子邮件扩展名代码片段恰好在关闭管道后放在方括号内,如下所示

post{
    always{
        script{emailext(to: '$DEFAULT_RECIPIENTS', stuff....)}}}

This way I did not receive binding errors on build and the email was sent to the mailing list from default recipients, also the brackets nested in post{} seem to be the triggers checked at the previous step. 这样,我在构建时没有收到绑定错误,而是从默认收件人将电子邮件发送到邮件列表,嵌套在post {}中的括号似乎是在上一步中检查的触发器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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