chaimp
chaimp

Reputation: 17907

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.

Upvotes: 7

Views: 15496

Answers (2)

Gonen
Gonen

Reputation: 4075

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

Upvotes: 19

Paul Dunnavant
Paul Dunnavant

Reputation: 616

I'm not sure if this is exactly what you're looking for, but the Email-ext plugin for Jenkins sounds like it may do what you want.

Upvotes: 3

Related Questions