/
How to bulk delete deployment projects in Bamboo using CLI

How to bulk delete deployment projects in Bamboo using CLI

This article explains how to bulk delete deployment projects in Bamboo server using the Bamboo Command Line Interface app.

Instructions

For this task, use the runFromCsv and deleteDeploymentProject CLI actions as explained:

  • runFromCsv: Runs all the actions generated from the CSV file with the mentioned parameters.
  • deleteDeploymentProject: Delete a deployment project by name or ID.
  • runFromListRun actions for each entry in a list with corresponding entry replacement variable.

To bulk delete the deployment projects:

Option 1: 

  1. Execute the following command If you know the name of the deployment projects:

    --action runFromList --list "1540097, Deploy_project1" --common "-a deleteDeploymentProject --deploymentProject @entry@ --continue"

Option 2: 

Execute the following command If you do not know the name of the deployment projects:

  1. Log in as a Bamboo administrator.
  2. Navigate to Deploy > All deployment projects to view all the deployment projects in the Bamboo instance.

  3. Take a note of the deployment project IDs or their names that are to be deleted.

  4. Create a CSV file named projects.csv with the list of the deployment projects to be deleted. These deployment projects are the ones noted in the previous step.

  5. Execute the following command:

    --action runFromCsv --file "/Downloads/Bamboo/projects.csv" --common "-a deleteDeploymentProject --continue"
    

    The output displayed on the terminal is similar to:

    --action runFromCsv --file "/Downloads/Bamboo/projects.csv" --common "-a deleteDeploymentProject --continue"
    
    Run: --deploymentProject "1540097" -a deleteDeploymentProject
    Deployment project '1540097' deleted.
    
    Run: --deploymentProject "Deploy_project1" -a deleteDeploymentProject
    Deployment project 'Deploy_project1' deleted.
    
    Run completed successfully. 2 actions were successful from file: /Downloads/Bamboo/projects.csv
    
    

  • It is recommended to test the commands in a non-production environment, or run the action with --simulate parameter to verify the behaviour before deploying.
  • Ensure you have the Bamboo Command Line Interface app installed in your Bamboo instance.

Related content