Child pages
  • Next Build Number Plugin
Skip to end of metadata
Go to start of metadata

Plugin Information

Plugin ID

next-build-number

Changes

In Latest Release
Since Latest Release

Latest Release
Latest Release Date
Required Core
Dependencies

1.5 (archives)
Oct 20, 2017
1.642.3
workflow-job (version:2.0, optional)
branch-api (version:2.0.11)
job-dsl (version:1.41, optional)
matrix-project (version:1.7, optional)

Source Code
Issue Tracking
Pull Requests
Maintainer(s)

GitHub
Open Issues
Pull Requests
Akom (id: akom)

Usage

Installations

2016-Oct 6397
2016-Nov 6566
2016-Dec 6454
2017-Jan 6860
2017-Feb 6940
2017-Mar 7365
2017-Apr 7234
2017-May 7507
2017-Jun 7504
2017-Jul 7470
2017-Aug 7696
2017-Sep 7597

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

Write a comment…