简体   繁体   中英

jenkins common build number

Is it possible to share BUILD_NUMBER between 2 jobs?
For example, a job B should use the next BUILD_NUMBER from the project A.

When I said 'share' this mean that both jobs should use the same counter automatically.

For example:

I have two different branches: stable and testing.
Once per 3 hour jenkins is checking for new commits and build new package in case some changes were merged into the branch.

I need that jenkins automatically can make builds like

testing01
testing02
testing03
stable04
testing05
stable06
testing07
..

You could try:

That would be possible if job B is a job DSL script

job('B') {
  properties {
    nextBuildNumber(47)
  }
}

Or you could use the CLI for job A to set job B

The problem with both of those approaches is that setting the build number will fail if job B own internal build number was already greater than the one job A want to set for job B.
So you need to make sure job B only builds when job A wants.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM