How can I add to a Jenkins pipeline an old-style post-build task which sends email when the build fails? I cannot find "Post-build actions" in the GUI for a pipeline. I know that I can wrap the entire build script try/catch, however, this seems ugly when the build script is large and continues to send emails even when the job was aborted manually. I would like to achieve the same functionality as with the previous email-ext
based post-build action.
try {
// Do sth
} catch(e) {
emailext body: '$DEFAULT_CONTENT',
recipientProviders: [
[$class: 'CulpritsRecipientProvider'],
[$class: 'DevelopersRecipientProvider'],
[$class: 'RequesterRecipientProvider']
],
replyTo: '$DEFAULT_REPLYTO',
subject: '$DEFAULT_SUBJECT',
to: '$DEFAULT_RECIPIENTS'
throw err
}
emailext body...
method above. Haven't found anything better and wasted enough time on this :) – Of