It seems that, when doing a build promotion in Jenkins using the Promoted Builds Plugin, it generates a new BUILD_ID environment variable. Is there a way, or a plugin that lets you access the current BUILD_ID of the build you are trying to promote?
Basically, the functionality I need is to: Navigate to a build in Jenkins, be able to launch an ant or gradle script to promote an already built artifact that is archived under the build I'm currently in.
Best Answer
Use the PROMOTED_JOB_NAME and PROMOTED_NUMBER variables to get the name and build number of the build being promoted. These two values are only set DURING the promotion process; they are part of the jobs build. This doesn't exactly map to BUILD_ID, but it does allow access to that build.
When I had this problem in the past, I did the following.