I am using Jenkins and Emailext plugin for emailing. Here is a test pipeline, which works fine:
pipeline
{
agent any
stages
{
stage ('Start')
{
steps
{
echo 'Hello'
// error('Abort to test failure.')
}
}
}
post
{
success
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [ requestor(), ? ]
)
}
failure
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
recipientProviders: [developers(), requestor(), culprits()]
)
}
}
}
I would like to send success emails to requestor and to "default recipients" which I specified under Manage Jenkins -> Configure System -> Extended E-mail Notification.
How do I add "default recipients" ($DEFAULT_RECIPIENTS) to recipientProviders?
Try like this:
success
{
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
to: '$DEFAULT_RECIPIENTS',
recipientProviders: [ requestor() ]
)
}
recipientProvidersparameter is used to add additional recipients.
This will send the email to both recipientProviders and DEFAULT_RECIPIENTS whenever job is success.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With