Skip to end of metadata
Go to start of metadata

Plugin Information

View Next Build Number on the plugin site for more information.

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 the 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 always increasing. 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 previous build. Changing this to a smaller number will do nothing.

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).  (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!

Job DSL

The build number can be changed as part of a Job DSL script.

job('example') {
  properties {
    nextBuildNumber(47)
  }
}

Changelog

Version 1.5

(info)  Support more job types (individual jobs from Multibranch Pipelines) (Thanks rjohnst!)

Version 1.4

(info)  Support more job types (eg Pipeline) (Thanks kad!)

Version 1.3

(info)  Add Job DSL extension point to allow specifying the nextBuildNumber at job creation time (Thanks daspilker!)

Version 1.1

(info) Add CLI command (JENKINS-14406)

5 Comments

  1. Just installed in Jenkins 1.559 - and I can't find any link anywhere to invoke this.

    1. I couldn't find the link as well at first. But after I restarted Jenkins, the link appeared above build history of the project. Not sure if that's where you were stuck.

  2. Also installed in Jenkins 1.590 and can't find link. :-(

  3. On 1.611, this doesn't display on workflow projects.  It also isn't possible to just add nextbuildnumber/ to the workflow project URL, as it returns a 404.

    It does show up and function on freestyle projects on 1.611.

  4. What's the maximum build_number limit for Jenkins build number that I can set for it to be a next build number?

    nm - found it's 2147483647 (INT Signed high bound limit).

    Any reason why Set Next Build Number was not designed to take a lower value than the previously / last build#? In my case, if I'm retaining only 1 build (discard all others) and if I reach the limit then I should be able to set the next build number to 1 so that Jenkins can start the build again. I know I can use Set Build Name (name setter plugin) to have infinite builds but still if I just want to use Jenkins BUILD_NUMBER and reached the limit, then this plugin (set next build number) should let me set it back to 1 (provided I didn't keep the builds/history).