Reputation: 33
Our Jenkins server is configured with two primary jobs to build apks. Each of those jobs has a child job that installs the APK onto an Android device that is attached to the build server and executes UI tests.
For example:
Project-A-apk
Project-A-tests
Project-B-apk
Project-B-tests
where
Project-A-apk kicks off Project-A-tests
Project-B-apk kicks off Project-B-tests
and
both Project-A-tests and Project-B-tests install and run on the same test device.
The issue is, we can't have the test jobs running at the same time, as they will both try to interact with the same device.
Is there a way to configure a job to wait until some other job (not in it's parent chain) before executing?
Upvotes: 1
Views: 2107
Reputation: 7048
We use the Jenkins Exclusion Plugin to manage our builds that have to share a couple of different DB resources. This plug works by allowing you to define Critical Blocks in your build steps. Critical blocks will only run if they can acquire a specific resource. At the end of the block the resource is released. This means that you don't have to block an entire job, just the parts that you need the resource for.
Upvotes: 0
Reputation: 2254
One more: Heavy Job Plugin
You can weight your Android jobs to block all executors.
Upvotes: 0
Reputation: 8908
I use the Throttle Concurrent Builds Plugin to control when jobs should run concurrently.
Setup a category name such as android-device with Maximum Concurrent Builds Per Node set to 1. Assign this category to the jobs that run the test on the android device. Once the plugin is installed there is a place to assign the category on the job configuration page.
All jobs with the same category name assigned will execute serially instead of concurrently.
Upvotes: 1
Reputation: 4110
You should try the Build Blocker Plugin:
This plugin keeps the actual job in the queue if at least one name of currently running jobs is matching with one of the given regular expressions.
Another way would be to limit the number of Jenkins executors to one. This would ensure that only one job is running and other wait in queue. However, this might block other future jobs that do not access the test device.
Upvotes: 0