How to prevent deployment plans to run on certain agents?

The relationship between build plans and agents can be managed through capabilities and fine tuned using custom capabilities. These features don't seem to exist for deployment plans.

We have Linux and Windows based agents for building. However, for deployment we want to only use the Linux based agents. How can we prevent deployment plans to run on the Windows based agents? And no - dedicating agents just to deployment plans is not feasible. The Linux agents must stay available for running build plans.

6 answers

1 accepted

0 votes
Accepted answer

You should be able to define a capability - a custom executable that exists only on the linux agents. This can be as simple as a shell script that does nothing. Just make sure that it exists in the same path and is executable (which may or may not truly be necessary but seems like it would throw an error if the script wasn't executable). I have a batch file on my local agents that prints the current date to the screen to restrict the build to a local agent (deployment plans should not be any different as you just insert a new task that uses the shell script). If the shell script exists on the server it will be available as meeting the requirements of the deployment plan. You'll need to add it into each stage though. A stage will revert to the next available agent even if the first stage is restricted via capabilities.

got it - bit clunky but workable


We're also doing this. Need to be able to specify requirements on Deployment plans.

see Requirement for Deployments

This plugin fixes the issue.

0 votes
Timothy Chin Community Champion Nov 07, 2013

Create a custom requrirement on the agent that you want to restrict it too. I can be anything that you want to define (e.g. the name of the build project).

Then for each job, add that custom requirement to it to force it to use that agent only.

If I may jump in...I would say this isn't a scalable solution, especially when you have over 100 deployment projects with multiple environments in each.

In our case, all of our agents are linux servers, with the exception of a mac mini that is designated for ios builds. I've been trying to figure out how to make sure deployments aren't run from the mac mini. Adding a dummy executable task to all of our deployment projects would be a headache. Is there any talk about adding the capability to exclude specific agents from being used as deployment servers?

I fully agree with your sentiments. The problem as I see it is that Deployment Plans are currrently gimped versions of Build Plans and lack some of the important features of Build Plans like stages and jobs and custom capabilities. For example for us a full deployment means updating a mix of environments (Windows and Linux) but a Deployment Plan can't deliver that as it has no stages that can run on different agents depending on capabilities. Build Plans can do that but Deployment Plans can't. I have no idea why Atlassian didn't make the full power of Build Plans available for Deployment Plans as obviously the infrastructure is already in place.

Actually, I just tried what Gretchen suggested and it still doesn't work.

@ Manuel - were you able to get the workaround to work as mentioned by Gretchen?

Here's what I did:

1) Added new executable capability (points to a dummy script) to the agents I want deployments to run on.

2) Added a Command task to a deployment project stage to run the newly-defined custom executable.

...and Bamboo is still showing all agents as capable of running the deployment. Hm...? I've confirmed the one agent I don't want deployments running on doesn't have the executable capability. I've also run the deployment just to see if it uses the excluded agent, and it did after a couple runs.

Any thoughts?

@Gretchen, am I missing something?

Nope, this is a bogus solution. It does not restrict what agents a deployment can run on, it just makes the deployment fail on certain agents.

Actually it might work in certain Bamboo versions. But the latest as of this writing gives you a better solution, using capabilities directly.

Same as Joe, I can exert no influence on the choice of agent for the deployment project, despite independently trying same.

Added comments to

Suggest an answer

Log in or Sign up to answer
Community showcase
Asked Thursday in Jira Ops

I'm John Allspaw, Ask Me Anything about incident analysis and postmortems

I'm John Allspaw, co-founder of   Adaptive Capacity Labs, where we help teams use their incidents to learn and improve. We bring research-driven methods and approaches to drive effective inciden...

4,449 views 20 14
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you