Hi Andreas,

thanks for that.

But what if there are some other builds between the startet downstreambuild?
I will explaine it:

MainJob starts two downstream-jobs (deployment- and test-job) with some 
specific parameter.
The deploymentjob could be used while the MainJob has triggered the 
downstreamjob.
So if i use your line of code, i will not get the buildnumber of right 
build.


Am Dienstag, 20. November 2012 09:26:51 UTC+1 schrieb Andreas Schilling:
>
> Hi Sven! 
>
> You were nearly there :-) 
>
> println(project.getFullName()+ ' ' + project.getNextBuildNumber()); 
>
> If you need the current build number you have to subtract 1. 
>
> Kind regards,
>
> Andreas Schilling
> CAE Processes & Data Management
> -------------------------------------------------------------------
> Dipl. Inf. Andreas Schilling
> Senior Software Architect
>
> TWT GmbH
> Science & Innovation
> Bernhäuser Str. 40 - 42
> 73765 Neuhausen
>
> Tel: +49 - 7158 - 17 15 - 673
> E-Mail: andreas....@twt-gmbh.de <javascript:>
> --------------------------------------------------------------------
> www.twt-gmbh.de
> --------------------------------------------------------------------
> Geschäftsführung: Dimitrios Vartziotis, Joachim Laicher (stv.)
> Registergericht: Amtsgericht Stuttgart, HRB Nr. 212778
> Umsatzsteuer: ID-Nr.: DE147841145
> -------------------------------------------------------------------- 
>
>
>
> Von:        Sven Finsterwalder <sab...@gmail.com <javascript:>> 
> An:        jenkins...@googlegroups.com <javascript:> 
> Datum:        20.11.2012 09:13 
> Betreff:        GetBuildnumber of started downstrem Job groovy 
> Gesendet von:        jenkins...@googlegroups.com <javascript:> 
> ------------------------------
>
>
>
> Hello, 
>
> i try to get the buildnumber of a started downstream Job with groovy. 
> Currently i got this: 
>
> def deploymentJob = 
> Jenkins.getInstance().getItemByFullName('deployment-universal-automatic-2.2') 
> println(deploymentJob.getDownstreamProjects()) 
>
>   List<AbstractProject> childs = deploymentJob.getDownstreamProjects() 
>   for (Iterator<AbstractProject> iterator = childs.iterator(); 
> iterator.hasNext();) { 
>             AbstractProject project = iterator.next(); 
>             println(project.getFullName()); 
>         } 
>   
> How can i now get the buildnumber of the DownstreamJob? 
> I have read the 
> *documentation*<http://javadoc.jenkins-ci.org/hudson/model/AbstractProject.html>but
>  i can not find a way to do it, please help me. 
>
> Thanks! 
>

Reply via email to