Jenkins pipeline - Notify with console error log through email

Viewed 7071

Currently I have configured a job with Jenkinsfile to send notification in case of a failure .

catch (err) {
    currentBuild.result = "FAILED"
    mail (to: 'viveky4d4v@gmail.com',
         subject: "Job '${env.JOB_NAME}'- (${env.BUILD_NUMBER}) has FAILED",
         body: "Please go to ${env.BUILD_URL} for more details. ");

    throw err
}

Is it possible to send console logs as well in the email in case of a job failure ?

2 Answers
Related