How to disable multiple plans or plan branches in batch
目的
Disable multiple plans or plan branches in batch.
ソリューション
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.
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:
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.
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:
bash -x enable_plans.sh