Antwort: Re: Re: GetBuildnumber of started downstrem Job groovy

2012-11-21 Thread Andreas Schilling
hi Sven,

there you go:


http://YOURSERVER/job/$
{buildName}/api/xml?xpath=/*/nextBuildNumber" dest="buildNumber.xml" />






To make this work you need to insert the correct URL of your Jenkins 
instance and the job name you want to get the build number from. In our 
case we pass this in as the property buildName, but for a first test you 
can hardcode it. Or maybe you don't need it configurable at all.

Hope that helps.

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 
An: jenkinsci-users@googlegroups.com
Datum:  21.11.2012 10:34
Betreff:    Re: Re: GetBuildnumber of started downstrem Job groovy
Gesendet von:   jenkinsci-users@googlegroups.com



Hi Andreas,

yes please give me the snippet.
I will try it.

Thanks.

Am Mittwoch, 21. November 2012 08:48:52 UTC+1 schrieb Andreas Schilling:
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@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  
An:jenkins...@googlegroups.com 
Datum:    21.11.2012 08:40 
Betreff:        Re: GetBuildnumber of started downstrem Job groovy 
Gesendet von:jenkins...@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  
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 childs = deploymentJob.getDownstreamPr

Re: Re: GetBuildnumber of started downstrem Job groovy

2012-11-21 Thread Sven Finsterwalder
Hi Andreas,

yes please give me the snippet.
I will try it.

Thanks.

Am Mittwoch, 21. November 2012 08:48:52 UTC+1 schrieb Andreas Schilling:
>
> 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@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 > 
> An:    jenkins...@googlegroups.com  
> Datum:21.11.2012 08:40 
> Betreff:Re: GetBuildnumber of started downstrem Job groovy 
> Gesendet von:jenkins...@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* <http://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  
> 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 childs = deploymentJob.getDownstreamProjects() 
>  for (Iterator 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! 
>


Antwort: Re: GetBuildnumber of started downstrem Job groovy

2012-11-20 Thread Andreas Schilling
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 
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  
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 childs = deploymentJob.getDownstreamProjects() 
  for (Iterator 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! 


Re: GetBuildnumber of started downstrem Job groovy

2012-11-20 Thread Sven Finsterwalder
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  
>> 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 childs = deploymentJob.getDownstreamProjects() 
>>   for (Iterator 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! 
>>
>

Re: GetBuildnumber of started downstrem Job groovy

2012-11-20 Thread 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 > 
> 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 childs = deploymentJob.getDownstreamProjects() 
>   for (Iterator 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! 
>


Antwort: GetBuildnumber of started downstrem Job groovy

2012-11-20 Thread 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.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 
An: jenkinsci-users@googlegroups.com
Datum:  20.11.2012 09:13
Betreff:    GetBuildnumber of started downstrem Job groovy
Gesendet von:   jenkinsci-users@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 childs = deploymentJob.getDownstreamProjects()
  for (Iterator 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!


GetBuildnumber of started downstrem Job groovy

2012-11-20 Thread Sven Finsterwalder
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 childs = deploymentJob.getDownstreamProjects()
  for (Iterator 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 
documentationbut
 i can not find a way to do it, please help me.

Thanks!