How to disable multiple plans or plan branches in batch
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Disable multiple plans or plan branches in batch.
Solution
Use the database to Build a sequence of REST calls to do the job:
This solution was designed considering a Postgres database and Unix like OS. It might need some small adjustments to run on a different DB or OS.
If your intention is to just create a staging server where you want the avoid running scheduled triggers, branch detection, and build status, you may follow this KB article to achieve the same.
Disabling the plans and plan branches
Run the following query on you Bamboo database:
Make sure you update <BAMBOO_ADMIN_USER>, <BAMBOO_PASSWORD> and <BAMBOO_URL> first.
1 2 3 4
SELECT concat('curl -k -u <BAMBOO_ADMIN_USER>:<BAMBOO_PASSWORD> -H "Content-type: application/json" -X DELETE <BAMBOO_URL>/rest/api/latest/plan/',concat(FULL_KEY,'/enable')) FROM BUILD
Create a file called disable_plans.sh with the results of the above query
Run the bash script file in debug mode:
1
bash -x disable_plans.sh
Enabling again the plans and plan branches
Run the following query on you Bamboo database:
Make sure you update <BAMBOO_ADMIN_USER>, <BAMBOO_PASSWORD> and <BAMBOO_URL> first.
1 2 3 4
SELECT concat('curl -k -u <BAMBOO_ADMIN_USER>:<BAMBOO_PASSWORD> -H "Content-type: application/json" -X POST <BAMBOO_URL>/rest/api/latest/plan/',concat(FULL_KEY,'/enable')) FROM BUILD
Create a file called enable_plans.sh with the results of the above query
Run the bash script file in debug mode:
1
bash -x enable_plans.sh
Was this helpful?