Define the number of jobs downstream from the main job in Jenkins

I have 2 Jenkins slaves with 1 master (3 cars). For example, Slave1 and Slave2. I have two jobs and labels used to bind jobs to slaves. For example, Job1 is tied to Slave1, and Job2 is tied to Slave2. Both are free style assignments. I created a free style task that only Job1 and Job2 call so that they work simultaneously on subordinates. I would like these two jobs to always be built with the same build number or inherit the build number from the job up. Is there a way that I could send the build number from the main job two jobs down? I would like the build numbers Job1 and Job2 not to fall into the synchronization that would occur if it started by itself.

+3
source share
1 answer

There is a method in the Jenkins Java API : Job :: updateNextBuildNumber (INT) . Thus, you can try the following: from the Groovy script system (which can be run through the Groovy Plugin ) to find the child task of the objects, set the build number on them using the method above; then run them.

However, you may still run into problems. For example, if one of these tasks is started manually, you cannot set the number on it (line numbers must increase).

+2
source

All Articles