jenkinsjenkins-workflow

Set build number for Jenkins workflow (pipeline) builds


I am migrating jenkins-workflow job to new template based workflow job. Because the build number is used as part of the version of build artifacts the workflow produces I have to start build number of the new workflow with a number greater than the old workflow. Unfortunately 'Next Build Number' plugin does not work with workflow pipeline.

Anybody knows a good way do this?


Solution

  • Try running below script in Jenkins Script Console.. Change "workFlow" to your Jobname

    def job = Jenkins.instance.getItem("workFlow")
    job.nextBuildNumber = 10
    job.saveNextBuildNumber()