Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I attach a build log to an e-mail notification with the Jenkins plugin Email-ext?

Version 2.15 of Jenkins plug-in Email-ext added support for attaching files to build notification e-mails. I would like to have the build log attached to build notification e-mails, but I can't figure out how to do it.

The build log appears to be stored on the Jenkins master node (in this case, Ubuntu Linux). For example, /var/lib/jenkins/jobs/<PROJECT_NAME>/builds/<DATE_TIME>/log. Naturally, the build log path changes with every build. The Email-ext file attachment feature defaults to using files from within the project workspace, which is on the Jenkins slave build machine (in this case, Mac OS X). For example, I configured my slave to use the folder /Users/<USERNAME>/Jenkins/build_agent/workspace/<PROJECT_NAME>/.

Is there any way to get Email-ext to attach a file from the master's file system, instead of the workspace on the slave build machine?

Thanks in advance to anyone who can offer some advice. The Email-ext wiki page currently does not contain an example of how to configure attachments.

like image 782
Steve HHH Avatar asked Dec 19 '11 07:12

Steve HHH


2 Answers

When using Jenkinsfile, add attachLog: true to the emailext configuration, like:

emailext attachLog: true, body: '', subject: ''

Credit to @Spencer Malone in Jenkins pipeline - Notify with console error log through email

like image 172
Penghe Geng Avatar answered Nov 05 '22 18:11

Penghe Geng


The plugin DOES support attaching the build log, you just need to check the box in the project configuration.

Project Configuration for email-ext

like image 38
slide Avatar answered Nov 05 '22 18:11

slide