Create your groovy script and place in under your $JENKINS_HOME/email-
templates. Create the email-templates directory if needed.
Say you call it foo.template.

In your jenkins job(s), configure your "Editable Email Notification"
Content area, like:

${SCRIPT,template="foo.template"}

Make sure you set 'Content Type' correctly (hml or text) based on what
output you are giving.
Also, if you have configured seperate triggers under advanced for
failured, fixed, ..., you might need to added the content there as
well which is what I do.

Doug

On Mar 24, 6:08 am, Chris Withers <[email protected]> wrote:
> On 24/03/2012 00:48, Slide wrote:
>
>
>
>
>
> > I use something like this in my groovy template
>
> > // the goal is to find the top level job which should contain the changelist
> > def upstreamBuild = null
> > def cause = build.causes.find {
> >      if(it instanceof hudson.model.Cause.UpstreamCause) {
> >          return true
> >      }
> >      return false
> > }
>
> > while(cause != null) {
> >      upstreamBuild =
> > hudson.model.Hudson.instance.getItem(cause.upstreamProject).getBuildByNumbe­r(cause.upstreamBuild)
> >      cause = upstreamBuild.causes.find {
> >          return (it instanceof hudson.model.Cause.UpstreamCause);
> >      }
> > }
>
> > Then I check if upstreamBuild is null or not, and if its not, I have
> > access to its information like this:
>
> > def changeSet = upstreamBuild.changeSet
>
> > And you can get the info you are looking for from there.
>
> Wow, cool, I'm afraid I'm a bit clueless though...
>
> Where do I put the code you've written above? File on disk or box in UI?
> (it either case, where and called what?)
>
> Once I've done that, how do I wire it into the email-ext template?
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
>             -http://www.simplistix.co.uk- Hide quoted text -
>
> - Show quoted text -

Reply via email to