On 25/07/2012 08:45, michael chiu wrote:
I don't know how to get upstream's changeset in email-ext . Do you know
how to access upstream's changeset in groovy in email-ext ?

From a previous thread where I asked the same thing, here's a reply from Slide:

-------- Original Message --------
Subject:     Re: email-ext - request for another jelly script example
Date:     Fri, 23 Mar 2012 17:48:19 -0700
From:     Slide <slide.o....@gmail.com>
To:     Chris Withers <ch...@simplistix.co.uk>
CC:     jenkinsci-users@googlegroups.com



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).getBuildByNumber(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.

slide


On Fri, Mar 23, 2012 at 3:35 AM, Chris Withers <ch...@simplistix.co.uk
<mailto:ch...@simplistix.co.uk>> wrote:

    On 19/03/2012 15:26, Slide wrote:

        This is awesome. Thanks for sharing! I've heard of several
        people who
        would like to do something like this. I'll try and add it to the
        wiki
        for email-ext.


    Sorry for topic hijacking, but I tried asking this before and got no
    response, yet this topic seems similar...

    So, I have a job (A) that uses artifacts from another job (B) and is
    also triggered by that job. That other job does the SCM polling, so
    when tests in Job A fail, them changelog is blank, just says
    "triggered by build #x of Job A".

    Does anyone have an email-ext example of how to get the changelog
    from Job A into the email-ext mail sent if Job B fails?

--
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk

Reply via email to