Quantcast

upstream changeset info in the email-ext notify from downstream project

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

upstream changeset info in the email-ext notify from downstream project

mchiu
Hi ALL,
           I found many article from you about jenkins email-ext . Can you give me some advice about upstream changeset .
I have 2 projects build and test . I would like to include
upstream changeset info when downstream is failed  in the email notification
.
         I have used the groovy temple [${SCRIPT,
template="groovy-html.template"}]in email-ext.
         Any advice will be appreciated.

Mchiu 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: upstream changeset info in the email-ext notify from downstream project

varghese

From my opinion you can use promotion plugin in upstream job, for sending the build details about the downstream job..
You can config email-ext in upstream through promotion build.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: upstream changeset info in the email-ext notify from downstream project

mchiu
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 ?

Varghese Renny於 2012年7月23日星期一UTC+8下午8時24分26秒寫道:

From my opinion you can use promotion plugin in upstream job, for sending the build details about the downstream job..
You can config email-ext in upstream through promotion build.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: upstream changeset info in the email-ext notify from downstream project

Chris Withers
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 <[hidden email]>
> To:     Chris Withers <[hidden email]>
> CC:     [hidden email]
>
>
>
> 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 <[hidden email]
> <mailto:[hidden email]>> 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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: upstream changeset info in the email-ext notify from downstream project

mchiu
In reply to this post by mchiu
Hi Chris,
               I have solve this issue after got the same message from slide. Below is the result .
               
               I'm using the slide's script to find out the upstream build then refine the original groovy template if the build has upstream build .
               

      def changeSet = null
       changeSet = build.changeSet
        if(upstreamBuild != null) {
           // now do stuff with that upstream build
           changeSet = upstreamBuild.changeSet
       }

michael chiu於 2012年7月23日星期一UTC+8下午7時52分19秒寫道:
Hi ALL,
           I found many article from you about jenkins email-ext . Can you give me some advice about upstream changeset .
I have 2 projects build and test . I would like to include
upstream changeset info when downstream is failed  in the email notification
.
         I have used the groovy temple [${SCRIPT,
template="groovy-html.template"}]in email-ext.
         Any advice will be appreciated.

Mchiu 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: upstream changeset info in the email-ext notify from downstream project

varghese
Thanks Chris..this code snippet is very helpful for me...Actually i was searching for this...Thanks again...
Loading...