0
votes

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.

Jenkins Ext Email notification using pre send script

1
what do you want exactly? more info on build? what kind of?Stan E
I want to know how i can achieve the above result using groovy script in Jenkins.Swachand Jambhulkar
Read the documentation. The wiki page has a list of "recipes", a "Template Examples" section, and various attachments.Christopher Orr

1 Answers

1
votes

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.