Cloudbees CI HA replicas do not sync next build number changes made through Script Console

1 minute readKnowledge baseLast reviewed 2026-09-30 ()

Issue

On a controller running in High Availability (HA) mode, updating a job’s next build number through the Script Console or the /scriptText endpoint (for example, with job.updateNextBuildNumber(100)) only takes effect on the replica that handled the request. Other replicas keep the previous value, so new builds may not use the expected build number.

Environment

Explanation

Script Console and /scriptText scripts run only on the replica that receives the request, and changes made with Job.updateNextBuildNumber() are not replicated to other replicas. Jenkins has no supported feature for setting an arbitrary build number at runtime. Build numbers are assigned automatically and sequentially to uniquely identify builds.

Resolution

This is expected behavior. If you need to trace a specific build, for example during a job migration, use the full build URL instead of a manually set build number.

Workaround

If you must change the next build number, for example for a one-time import:

  1. Stop the controller.

  2. Edit the $JENKINS_HOME/jobs/<job-path>/nextBuildNumber file and set the desired value.

  3. Start the controller.

  4. Trigger a build and confirm it uses the expected build number.

Make sure the controller is fully stopped before editing the file.

Tested product/plugin versions

This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by Cloudbees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.