This is a simple plugin that changes the next build number Jenkins will use for a job.
This plugin is typically useful if you are using $BUILD_NUMBER
as part of a version string, and:
- You do a build outside of Jenkins and you want to skip that number for the next build to avoid duplicate version numbers or failures.
- You created a new job to handle an existing process and want it to continue from where the old one left off.
Jenkins requires that build numbers are not duplicated. When you click on the link installed by this plugin, a text field will be shown that contains the next build number to be used. You can change this number to be anything larger than the value for the most recent build
Note: Changing this to a number lower than the latest build number will do nothing. You can, however, go back to a previously used number if you delete builds.
The value can be changed:
- Graphically by using the Set Next Build Number link for each job (see screenshot)
- Via the CLI using the
set-next-build-number
command (Requires >= v1.1) - Programmatically via the Job DSL plugin (see [usage](#Job DSL)). (Requires >= v1.3 of this plugin and Job DSL >= 1.41)
Manual Usage:
Note: Not all job types are supported. If support is missing for your job type, feel free to make a Pull Request!
The build number can be changed as part of a Job DSL script.
job('example') {
properties {
nextBuildNumber(47)
}
}
- Prevent non-numeric input when setting next build number interactively (Thanks NotMyFault!)
- Fix multibranch job support in Jenkins >= 2.266 (Thanks eoc-ross!)
- Support more job types (Organization Folders) (Thanks res0nance!)
- Support more job types (individual jobs from Multibranch Pipelines) (Thanks rjohnst!)
- Support more job types (eg Pipeline) (Thanks kad!)
- Add Job DSL extension point to allow specifying the nextBuildNumber at job creation time (Thanks daspilker!)
- Add CLI command (JENKINS-14406)