vezenkov
vezenkov

Reputation: 4155

Jenkins - start a job from Build Flow Job with the same build number as the running job

With DSL I can do something like:

bnumber = build.environment.get("BUILD_NUMBER")
build("Compile.Net", BUILD_NUMBER: bnumber)

which is great. It seems to set the BUILD_NUMBER var of the downstream job. However the display name is still with the incremented automatically number and also if I manually start the job after, it will have incremented build number from the wrong one (not the one that has been passed as a parameter). I guess there is another action needed as a shell script or something to set the BUILD_NUMBER and Displayname and save it incremented in the configuration as nextBuildNumber file. Perhaps this PlugIn could help:

https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin

The question is if there is a better way of doing it or I should continue to work in the same direction? Is there a better way of setting the build number of a downstream job to be the same as the build flow job?

Upvotes: 1

Views: 337

Answers (0)

Related Questions