Is there a way to start bamboo that forces all agents to be disabled?
Asked by Ken Wood:

I have a testbed where we are testing the latest version of Bamboo in preparation for upgrading our production instance.

I exported the plans from the current instance, imported them into the new instance (running on a different server), and then shut down the new instance because I didn't want any builds to accidentally fire up.

Is there a way to start the test instance of Bamboo that forces all the agents to be disabled so no build will run?


Answers:
author: PiotrA
body: To add my 2c to the existing answers:

<http://docs.atlassian.com/atlassian-bamboo/latest/com/atlassian/bamboo/utils/SystemProperty.html#BUILDING_DISABLED>

There is an "atlassian.bamboo.build.disable" internal property that can control whether Bamboo plans are checking for the changes in repositires - unfortunately from what I see in source code that property doesn't prevent triggering plans that use "Daily" or "Cron Scheduled" strategies. Though, it might be mindful to use that property together with other solutions you will use - just as another (but partial) precaution step.

comments: author: Ken Wood
body: PS Would it make sense to file an enhancement request to support --disable as a flag to bamboo.sh? Then the 'bamboo.sh' script could invoke a java class written to go to the database and disable the agents before starting Bamboo. Better than rather than relying on an external sql script from a maintenance point of view in that, if in a later version of Bamboo the method to disalbe agents change, the details are hidden from end users, we would only have to rely on the --disable option to 'bamboo.sh'


author: Ken Wood
body: Thanks for the info. These two insights will also be useful in case of an unscheduled outage on production server. When I have scheduled downtime, for example because of planned hardware maintenance, I always use the UI to disable all agents, then I have a script I run that shuts down all remote agents, then I log off and use "./bamboo.sh stop" to cleanly shut down Bamboo. That way when I start bamboo I know nothing will happen until I re-enabloe everything. But if there is a hardware failure or a power outage or something that causes a shutdown without a chance to disable agents first, these tips will be useful to prevent builds when Bamboo is brought back up.


author: Adam Myatt
body: Though I typically discourage messing with the database, the safest thing is to jump into the database. The remote agents are listed in the QUEUE table. If you update the ENABLED field to 0 for each agent, it will disable them upon start.

update QUEUE set ENABLED=0

If you have Elastic Agents defined then you would update the ELASTIC_IMAGE table (i think the enabled/disabled field for those is called IMAGE_DISABLED.

comments: author: Ken Wood
body: Thanks for the info.


author: Brent Villalobos
body: In the Administration--\>Agents menu there is a link to select all agents and then you can hit the disable button.

comments: author: Ken Wood
body: Yes, there is. I want to disable the agents when Bamboo starts. If I have to go to the admin page and select agents, then disable them, there is plenty of time for Bamboo to try to start a build. I don't want any builds to start. I'm hoping there is a flag, i.e. something like "./bamboo.sh start --disable agents