I have gearman, multiple jenkins masters, and several slaves. The infrastructure is like below:
Gearman
__________________|____________________
| |
Jenkins Master 1 Jenkins Master 2 Jenkins Master 3 (Public jenkins)
___________|____________ __________|__________
| | | | | |
Slave 1 Slave 2 Slave 3 Slave 4 Slave 5 Slave 6
I queue a job by sending a request to Gearman, then it decides which jenkins master should handle the job. After a job is built, jenkins will publish it to Jenkins Master 3 using Build Publisher Plugin.
The tricky bit is, let's say I have a job name "job_test_1" on Jenkins Master 1 and Jenkins Master 2. The first time I queue a job on Gearman, it decides to forward the job to Jenkins Master 1. When it is built, the job has build number 1. After then, I queue a job again on Gearman but this time it decides to forward the job to Jenkins Master 2. When it is built, it got build number 1 since it's the first build on this Jenkins Master. When it publishes build to Jenkins Master 3, the result will overwrite build number 1 on Jenkins Master 1 because it has the same build number.
I read on a Jenkins forum and it seemed like this is by design. Is there a way to work around this problem?