Retrieving the last successful build number of a job from another job.

11,919 views
Skip to first unread message

Stathis

unread,
Nov 21, 2011, 4:49:37 PM11/21/11
to Jenkins Users
I have two jobs that are independent Job-A and Job-B.
Is there a way to have Job-A know what is the latest successful build
number for Job-B and Job-B know what is the latest successful build
number of Job-A.
Thanks
S.

Mark Waite

unread,
Nov 21, 2011, 5:03:22 PM11/21/11
to jenkins...@googlegroups.com
If you can find a way to consume the API output, you can query the job status with the lastSuccessfulBuild tag in the XML output like this:


If you have a build step that will consume that status (python, ruby, perl, etc.), then the API is probably sufficient.  If you need that information inside Jenkins at run time, then the API technique may not work for you.

Thanks,
Mark Waite


From: Stathis <stat...@gmail.com>
To: Jenkins Users <jenkins...@googlegroups.com>
Sent: Monday, November 21, 2011 2:49 PM
Subject: Retrieving the last successful build number of a job from another job.

Henk van Voorthuijsen

unread,
Nov 22, 2011, 6:46:36 AM11/22/11
to Jenkins Users
You probably need the last stable build, not the last "successful"
one:
http://<JENKINS>/job/<JOB_NAME>/lastStableBuild

On Nov 21, 11:03 pm, Mark Waite <markwa...@yahoo.com> wrote:
> If you can find a way to consume the API output, you can query the job status with the lastSuccessfulBuild tag in the XML output like this:
>

> http://ci.jenkins-ci.org/view/Jenkins%20core/job/jenkins_main_trunk/a...


>
> If you have a build step that will consume that status (python, ruby, perl, etc.), then the API is probably sufficient.  If you need that information inside Jenkins at run time, then the API technique may not work for you.
>
> Thanks,
> Mark Waite
>
>
>
>
>
>
>
> >________________________________

> > From: Stathis <stath...@gmail.com>

Christopher Orr

unread,
Nov 27, 2011, 9:27:11 AM11/27/11
to jenkins...@googlegroups.com
Even simpler:
http://ci.jenkins-ci.org/job/jenkins_main_trunk/lastStableBuild/buildNumber

"This URL returns the build number in text/plain format."

Regards,
Chris


On 21/11/2011 23:03, Mark Waite wrote:
> If you can find a way to consume the API output, you can query the job
> status with the lastSuccessfulBuild tag in the XML output like this:
>
> http://ci.jenkins-ci.org/view/Jenkins%20core/job/jenkins_main_trunk/api/xml
>
> If you have a build step that will consume that status (python, ruby,
> perl, etc.), then the API is probably sufficient. If you need that
> information inside Jenkins at run time, then the API technique may not
> work for you.
>
> Thanks,
> Mark Waite
>

> ------------------------------------------------------------------------
> *From:* Stathis <stat...@gmail.com>
> *To:* Jenkins Users <jenkins...@googlegroups.com>
> *Sent:* Monday, November 21, 2011 2:49 PM
> *Subject:* Retrieving the last successful build number of a job from

Vijay Srivastava

unread,
May 14, 2012, 3:13:12 AM5/14/12
to jenkins...@googlegroups.com
Hi,

do you know how can i use http://epfap1q.nam.nsroot.net:7778/job/A/lastStableBuild/buildNumber in another job B configuration ?

Renjith G

unread,
May 14, 2012, 5:36:34 AM5/14/12
to jenkins...@googlegroups.com
Hi Vijay,

Which version of J.Build are u using and which is your device spec please

/kanu

Vijay Srivastava

unread,
May 14, 2012, 8:15:15 AM5/14/12
to jenkins...@googlegroups.com


On Tuesday, November 22, 2011 3:19:37 AM UTC+5:30, Stathis wrote:

Vijay Srivastava

unread,
May 14, 2012, 8:15:39 AM5/14/12
to jenkins...@googlegroups.com
Hi Kanu,

I'm using Jenkins ver. 1.454 using browser client.

regards


On Monday, May 14, 2012 3:06:34 PM UTC+5:30, Kanu wrote:
Hi Vijay,

Which version of J.Build are u using and which is your device spec please

/kanu
/kanu

Mandeville, Rob

unread,
May 14, 2012, 8:26:26 AM5/14/12
to jenkins...@googlegroups.com

Maybe I’m answering the wrong question, but if Job-A and Job-B can both do HTTP and read XML, you can get a last stable build number like this:

 

http://jenkins_server:8080/jenkins/job/Job-A/api/xml?xpath=/*/lastStableBuild/number

 

assuming that your Jenkins server is on http://jenkins_server:8080/jenkins.

 

--Rob Mandeville

 

From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of Vijay Srivastava
Sent: Monday, May 14, 2012 8:16 AM
To: jenkins...@googlegroups.com
Subject: Re: Retrieving the last successful build number of a job from another job.

 

Hi Kanu,

 

I'm using Jenkins ver. 1.454 using browser client.

 

regards

On Monday, May 14, 2012 3:06:34 PM UTC+5:30, Kanu wrote:

Hi Vijay,

 

Which version of J.Build are u using and which is your device spec please

 

/kanu

On Mon, May 14, 2012 at 12:43 PM, Vijay Srivastava <reach.vijay...@gmail.com> wrote:

Hi,

 

do you know how can i use http://epfap1q.nam.nsroot.net:7778/job/A/lastStableBuild/buildNumber in another job B configuration ?

On Tuesday, November 22, 2011 3:19:37 AM UTC+5:30, Stathis wrote:

I have two jobs that are independent Job-A and Job-B.
Is there a way to have Job-A know what is the latest successful build
number for Job-B and Job-B know what is the latest successful build
number of Job-A.
Thanks
S.

 


On Monday, May 14, 2012 3:06:34 PM UTC+5:30, Kanu wrote:

Hi Vijay,

 

Which version of J.Build are u using and which is your device spec please

 

/kanu

On Mon, May 14, 2012 at 12:43 PM, Vijay Srivastava <reach.vijay...@gmail.com> wrote:

Hi,

 

do you know how can i use http://epfap1q.nam.nsroot.net:7778/job/A/lastStableBuild/buildNumber in another job B configuration ?

On Tuesday, November 22, 2011 3:19:37 AM UTC+5:30, Stathis wrote:

I have two jobs that are independent Job-A and Job-B.
Is there a way to have Job-A know what is the latest successful build
number for Job-B and Job-B know what is the latest successful build
number of Job-A.
Thanks
S.

 

The information in this message is for the intended recipient(s) only and may be the proprietary and/or confidential property of Litle & Co., LLC, and thus protected from disclosure. If you are not the intended recipient(s), or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication is prohibited. If you have received this communication in error, please notify Litle & Co. immediately by replying to this message and then promptly deleting it and your reply permanently from your computer.
Reply all
Reply to author
Forward
0 new messages