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 <[email protected]>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?
>
> cheers,
>
> Chris
>
> --
> Simplistix - Content Management, Batch Processing & Python Consulting
> - http://www.simplistix.co.uk
>
--
Website: http://earl-of-code.com