This plugin uses Gearman to support multiple Jenkins masters.
No information for the plugin 'gearman' is available. It may have been removed from distribution.
No information for the plugin 'gearman-jenkins' is available. It may have been removed from distribution.
Jenkins core does not support multiple masters. You can setup multiple Jenkins masters but there is no coordination between them.
One problem with scheduling builds on Jenkins master (“MasterA”) server is that MasterA only knows about its connected slaves. If all slaves on MasterA are busy then MasterA will just put the next scheduled build on its queue. Now MasterA needs to wait for an available slave to run the build. This will be very in-efficient if your builds take a long time to run. So.. what if there is another Jenkins master (“MasterB”) that has free slaves to service the next scheduled build? Your probably saying “Then slaves on MasterB should run the build” then I would say "good thought!". However MasterB will never service the builds on MasterA's queue. The client that schedules the builds must know about MasterB and then schedule builds on MasterB. This is what we mean by lack of coordination between masters. This gearman-plugin attempts to fill the gap.
This plugin integrates Gearman with Jenkins and will make it so that any Jenkins slave on any Jenkins master can service a job in the queue. It will essentially replace the Jenkins build queue with the Gearman job queue. The job will stay in the Gearman queue until there is a Jenkins node (master or slave) that can run that job.
This assumes some familiarity with Jenkins and Gearman
- Install the Gearman plugin like any other Jenkins plugin, refer to the Jenkins documentation.
- If you don't already have a Gearman server up and running somewhere you should install one. To install on Ubuntu just run "sudo apt-get install gearman-job-server". This should install gearmand service and automatically start it for you. By default it will run on $hostname:4730
The Gearman plugin configuration should appear in the Jenkins global configuration page. Click on the help bubbles if you need help with the configuration. Clicking on the Launch Workers checkbox will start the gearman workers for the Jenkins server. You should test the connection to your Gearman Server before launching the workers.
Starting the Gearman workers:
- On a 'Launch Worker', a Gearman worker thread is spawned for each executor on master and slave nodes. We'll call these "executor worker threads". Each executor worker thread is associated 1:1 with a Jenkins executor.
- Now we register jobs for each Gearman executor depending on the projects, labels and nodes that have been setup on the Jenkins. View the image to see how the Jenkins projects get mapped to Gearman functions.
- We spawn one more thread to be a Gearman worker to handle job management. We'll call it the "management worker thread" and it will register a "stop:$hostname" Gearman function. We use this worker to abort jenkins build jobs. Build jobs are either on the Gearman queue or it's currently running being run by Jekins.
Running a Jenkins build:
- Any Gearman client can connect to the Gearman server and send a request to build a Jenkins project. The client just needs to provide the Gearman hostname, port, function, and UUID to start a jenkins build. Look in github for the Gearman StartJob client example.
- The Gearman workers which were spawn by the Gearman Plugin will service any client request that come through to start and cancel a Jenkins build.
Stopping a Jenkins build:
- Any Gearman client can connect to the Gearman server and send a request to cancel a build. The client will need to provide the Gearman host, port and the UUID that was sent in to start the job. Look in github for the G earman StopJob client example.
- 0.0.1 - initial release.
- Dynamically update Gearman functions upon changes Jenkins executors.
- This pliugin does not register functions correctly for Jenkins Matrix Projects.
- Cancel build jobs from the Gearman queue.