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