Sven,

as far as I understood the point is that the order of job 
execution/triggering is important because the build number you want to 
have can then happen to be off by 1 or something?
If you need the build number of a downstream job at a very specific point 
in time (e.g. right when the upstream job starts but has not yet triggered 
the downstream job) I'd suggest to include that into your build script. I 
can give you a snippet for ant that does that.

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.schill...@twt-gmbh.de
--------------------------------------------------------------------
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>
An:     jenkinsci-users@googlegroups.com
Datum:  21.11.2012 08:40
Betreff:        Re: GetBuildnumber of started downstrem Job groovy
Gesendet von:   jenkinsci-users@googlegroups.com



Good morning,

is there no one who can help me?

Thanks.

Am Dienstag, 20. November 2012 09:44:24 UTC+1 schrieb Sven Finsterwalder:
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
--------------------------------------------------------------------
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> 
An:        jenkins...@googlegroups.com 
Datum:        20.11.2012 09:13 
Betreff:        GetBuildnumber of started downstrem Job groovy 
Gesendet von:        jenkins...@googlegroups.com 



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 but i can not find a way to do it, please 
help me. 

Thanks! 

Reply via email to