Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have output of script emailed from Jenkins?

I am setting up a Jenkins job that processes some data.

Once the job is finished, I would like to have jenkins run a script that describes the status of the recent processing and email the stdout of that script to a specified email address.

While I realize that it is possible to have the script send the email itself, I am wondering if there exists a more ideal way to have Jenkins send the output of that script. Is there a plugin that is idea for this?

Thanks.

like image 890
chaimp Avatar asked Jul 24 '12 01:07

chaimp


1 Answers

To configure the Email-ext plugin:

To get a portion of the log in the mail, if not all, set the 'Extended E-mail Notification' to send an email for each build that failed, and use the $BUILD_LOG in the body of the message:

  1. In the body of the message (below the '$DEFAULT_CONTENT' ) add the parameter $BUILD_LOG to display the end of the build log
  2. Assuming the log is in plain-text, change 'Content Type' to Plain Text

For the list of built-in Jenkins parameters, go to this page:

  • http://[your-jenkins-server]/env-vars.html

Cheers

EDIT:

To get to that list of available env-vars via the UI,
there is a link at the Execute shell build-step, for example -

Link to Env-Vars list via the UI

like image 73
Gonen Avatar answered Oct 24 '22 18:10

Gonen