recipientProviders in jenkins pipeline are always empty
Asked Answered
S

1

9

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. I triggered from gitlab push webhook there is no email address configured in any of the recipientProviders.

    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?

Semite answered 12/6, 2017 at 15:20 Comment(0)
K
0

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

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.

Kappenne answered 26/3, 2019 at 12:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.