How to disable multiple plans or plan branches in batch

Still need help?

The Atlassian Community is here for you.

Ask the community

Purpose

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


  1.  Run the following query on you Bamboo database:

    tip/resting Created with Sketch.

    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
  2. Create a file called disable_plans.sh with the content above

  3.  Run the bash script file in debug mode:

    bash -x disable_plans.sh


Enabling again the plans and plan branches

  1.  Run the following query on you Bamboo database:

    tip/resting Created with Sketch.

    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
  2. Create a file called enable_plans.sh with the content above

  3.  Run the bash script file in debug mode:

     bash -x enable_plans.sh


Last modified on Jun 3, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.