recently we started moving out jenkins jobs to Jenkins pipeline and we are running to some problems with email sending.
If I do something like this
node('WCH-Regression') {
// do the first test
stage 'Test'
node {
try {
sh 'exit 1'
} catch(err) {
echo "Error"
currentBuild.result = "FAILURE"
} finally {
step([$class : 'Mailer',
notifyEveryUnstableBuild: true,
recipients : "ppolivka@xxx.yyy",
sendToIndividuals : true])
}
}
}
The email is acknowledged in the job log, but never delivered.
[Pipeline] {
[Pipeline] sh
[workspace] Running shell script
+ exit 1
[Pipeline] echo
Error
[Pipeline] step
Sending e-mails to: ppolivka@xxx.yyy
[Pipeline] }
[Pipeline] // node
If I do the same thing in normal Jenkins job email is delivered. Also test emails from email configuration in 'Manage Jenkins' are delivered. Do I need to somehow enable emails for pipeline?
We are running Jenkins: 2.7.2 Pipeline plugin 2.2 Mailer plugin 1.17
I just tried to simply send email via
node {
mail body: 'test', subject: 'test', to: 'ppolivka@xxx.yyy'
}
And still nothing was received. My email configuration in jenkins is fine, all other non pipeline jobs are sending emails and test email from the email notification configuration is working. Why would pipeline emails would not be delivered?