I am trying to set the next build number for our release branch programmatically but I'm facing an issue.
Below are the two ways I tried it:
def job = Jenkins.instance.getItem("master")
job.nextBuildNumber = env.BUILD_NUMBER + 1
job.saveNextBuildNumber()
I tried using CLI
command also:
java -jar ${env.HOME} jenkins-cli.jar -s XX-JENKINS-SERVER" set-next-build-number 'Pipeline/master' 44
But no luck.
Please guide me how to set up next build number for multibranch pipeline.