Currently I use the EC2 plugin with Jenkins, so when it needs more agents (slaves) it starts them up (or kills them when not needed). Up till now the agents have been configured with 2 job slots which is fine. However there is one particular job that requires the entire EC2 instance.

So, how can I block other jobs from running on an agent while this particular job is running? Normally the solution would be to filter the job to one set of special agents but I'd like to avoid creating an entirely new fleet of agents just for this one job.


You can use Run Condition plugin, https://wiki.jenkins-ci.org/display/JENKINS/Run+Condition+Plugin to disable any other jobs based on the fact that a particular job is running. You can find out how to get the currently running job info here, https://stackoverflow.com/questions/7285891/determine-if-given-job-is-currently-running-using-hudson-jenkins-api.

  • That is a very interesting plugin, unfortunately that doesn't work in my case. We have 50 something jobs in our Jenkins and I can't stop the rest because one job is running. Also that still wouldn't assure our job ran on it's own (could be started on an instance with another job already running). Thanks though! – Jon Mar 29 '17 at 17:25
  • You can make a requirement global by using the Configuration Slicing plugin. wiki.jenkins-ci.org/display/JENKINS/… – postoronnim Mar 29 '17 at 17:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.