Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins/Hudson - accessing the current build number?

I have a report file I'm generating, and I would like to be able to add the current build number to that file within a Jenkins job. Is there an environment variable or plugin I can use to get at the current build number?

like image 718
Stefan Kendall Avatar asked Aug 23 '11 21:08

Stefan Kendall


People also ask

How do I find the build number of Jenkins?

The list is also available from within your Jenkins instance at http://hostname/jenkins/env-vars.html. Show activity on this post. Reload Configuration from Disk from the Manage Jenkins View. Show activity on this post.

How can I see Jenkins pipeline configuration?

Click New Item on your Jenkins home page, enter a name for your (pipeline) job, select Pipeline, and click OK. In the Script text area of the configuration screen, enter your pipeline syntax.


1 Answers

BUILD_NUMBER is the current build number. You can use it in the command you execute for the job, or just use it in the script your job executes.

See the Jenkins documentation for the full list of available environment variables. The list is also available from within your Jenkins instance at http://hostname/jenkins/env-vars.html.

like image 123
Richard Fearn Avatar answered Oct 09 '22 08:10

Richard Fearn