Jenkins / Hudson - access to current build number?

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

+49
continuous-integration hudson jenkins hudson-plugins
Aug 23 2018-11-21T00:
source share
2 answers

BUILD_NUMBER - current build number. You can use it in the command that you execute for the task, or simply use it in the script that the task you are running.

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

+76
Aug 23 2018-11-21T00:
source share

I also ran into this question and found out that if at any time the build number gets corrupted due to some kind of abnormal start of the jenkins instance, you can manually return the build number by editing the nextBuildNumber file (pathToJenkins \ jobs \ jobxyz \ nextBuildNumber), and then reboot using the option
Reboot the configuration from disk from the "Manage Jenkins View" section.

+8
Nov 29 '12 at 12:24
source share



All Articles