sharing common build number between jobs

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

sharing common build number between jobs

Matt Fair
I would like to have a common build number as an environment that is
shared through my whole pipeline for a specific build. For each job
BUILD_NUMBER may be different because of failure or manual stages, but
it would be nice to have an environment variable like
PIPELINE_BUILD_NUMBER.  Is there a way to create an environment
variable in the first stage of my pipeline and pass it on to the
downstream jobs?
Thanks,
Matt
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: sharing common build number between jobs

Mark Waite
I don't know of a way to pass environment variables or other properties between jobs without using the SCM system to do it.
 
We use a different technique that I think gives the same result. 
 
We designate that the first stage of the build pipeline is responsible to set the build number once the compilation has succeeded.  That build number is submitted to the source repository so the build is repeatable with its version number.  If the first stage fails, the build number is not incremented.  If it succeeds, the build number is incremented and the later stages can use the same build number in their work.
 
Mark Waite

From: Matt Fair <[hidden email]>
To: [hidden email]
Sent: Friday, January 27, 2012 4:25 PM
Subject: sharing common build number between jobs

I would like to have a common build number as an environment that is
shared through my whole pipeline for a specific build. For each job
BUILD_NUMBER may be different because of failure or manual stages, but
it would be nice to have an environment variable like
PIPELINE_BUILD_NUMBER.  Is there a way to create an environment
variable in the first stage of my pipeline and pass it on to the
downstream jobs?
Thanks,
Matt


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

Re: sharing common build number between jobs

Slide

We do something similar, but our "top level" job just uses the parameterized trigger plugin to send the build number to the other builds.

On Jan 27, 2012 7:22 PM, "Mark Waite" <[hidden email]> wrote:
I don't know of a way to pass environment variables or other properties between jobs without using the SCM system to do it.
 
We use a different technique that I think gives the same result. 
 
We designate that the first stage of the build pipeline is responsible to set the build number once the compilation has succeeded.  That build number is submitted to the source repository so the build is repeatable with its version number.  If the first stage fails, the build number is not incremented.  If it succeeds, the build number is incremented and the later stages can use the same build number in their work.
 
Mark Waite

From: Matt Fair <[hidden email]>
To: [hidden email]
Sent: Friday, January 27, 2012 4:25 PM
Subject: sharing common build number between jobs

I would like to have a common build number as an environment that is
shared through my whole pipeline for a specific build. For each job
BUILD_NUMBER may be different because of failure or manual stages, but
it would be nice to have an environment variable like
PIPELINE_BUILD_NUMBER.  Is there a way to create an environment
variable in the first stage of my pipeline and pass it on to the
downstream jobs?
Thanks,
Matt


Loading...