Reputation: 35
I want to know how pre-send script works in Jenkins Extendable email notification. Right now I am using some variables like
Build summary:
$PROJECT_NAME"
"Build Number - $BUILD_NUMBER"
"Build Result - $BUILD_STATUS"
"Build Time $BUILD_ID"
"SVN Revision Number $SVN_REVISION"
"Changes Made By - $CHANGES"
"$CAUSE"
"Please see build log as an attachment.
Under default content, but I would like to know how to get more details using a groovy script in rich text format like example bellow.
Upvotes: 0
Views: 4422
Reputation: 410
Basically, as mentioned, read the documentation. But, in short:
In the Content
section of the Email-ext configuration for a job/trigger, enter:
${SCRIPT, template="scriptname.template"}
...where scriptname.template
is a Groovy template located in ${JENKINS_HOME}/email-templates
. You must create the email-templates
directory yourself.
Example templates and other recipes can be found linked from the Email-ext documentation.
Something that helps make email templates very convenient to test is the Email Template Testing
link. For a given Jenkins job, you'll see it in the left navigation/link area, and in the context drop-down for a job. Then you simply provide the name of your template (e.g., scriptname.template
) and the tool uses a selectable build of a given job to render the template.
Upvotes: 1