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?
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.
I've just come across this question too and found out that if anytime the build number gets corrupt because of any error-triggered hard shutdown of the jenkins instance you can set back the build number manually by just editing the file nextBuildNumber (pathToJenkinsjobsjobxyznextBuildNumber) and then make a reload by using the option
Reload Configuration from Disk from the Manage Jenkins View.
上一篇: Jenkins / Hudson / Teamcity /等连续SVN Diff
下一篇: 访问当前的内部版本号?