Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Any Script's are available to delete multiple plans in bamboo ?

SunadhRaj.Malaka June 7, 2023

Any Script's are available to delete multiple plans in bamboo ?

 

we decided to delete 26000 plans, these plans are in different years so cannot delete them by using rm -rf command .

we are working out for some customization to delete these plans.

can we try using rest api ?  or can any one suggest some best way to delete those plans.

 

 

Thanks

Sunadh Raj 

9 answers

2 votes
Anik Sengupta
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 7, 2023

The PROJ_KEY-PLAN_KEY.txt file is an input file which you can create in the Bamboo server.

You can create it in an path where you need to run the script.  Use the path as the path to the input file  for example if you put the script in /home/bamboo/. So path here would be  /home/bamboo/.

PROJ_KEY-PLAN_KEY.txt should contain Projkey-plankey of multiple plans one in each line as shown in the example. 

cat PROJ_KEY-PLAN_KEY.txt
PROJ1-PLAN1
PROJ2-PLAN2
PROJ3-PLAN3
PROJ4-PLAN4
1 vote
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 7, 2023

Hey @SunadhRaj.Malaka

Try this KB article:

Thank you,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

1 vote
SunadhRaj.Malaka June 7, 2023

Not finding any proper REST API . to get solution to delete selected multiple plans.

 

this is python code :

import requests

url = "http://bamboo-dev.amd.com/rest/api/latest/plan/SPACBAM-{buildKey}"

response = requests.request(
"DELETE",
url
)

print(response.text)

can i use for loop to this code and by mentioning multiple buildkey or fullkey , and test this ?

1 vote
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 7, 2023

Hello @SunadhRaj.Malaka

Please don't use "rm" to delete Bamboo contents. Bamboo data is stored in many different places, including the database and are tightly connected. Deleting data directly at the file system level is not supported and may break your instance.

Please use the REST API to automate the deletion of plans in bulk or use the "Remove Plans" function by following this path:

  • Bamboo Administration >> Remove Plans

Cheers,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

0 votes
Anik Sengupta
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 26, 2023

Try running the curl command as below without the quotes 

 

curl -u "$username:$password" -X DELETE --url http://<BAMBOO_URL>/rest/api/latest/plan/$line
0 votes
SunadhRaj.Malaka June 12, 2023

While running

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><status><status-code>404</status-code><message>null for uri: http://hostname:8085/rest/api/latest/plan/$line</message></status>projt1-plan1

 

http://hostname:8085/rest/api/latest/plan/$line

$line is showing error 

 

can you please help out

0 votes
Anik Sengupta
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 9, 2023

Yes please run in against your test environment first . Use the Bamboo test server to run this . As input file you can include the list of PROJKEY-PLANKEY which you are looking to delete in bulk.

0 votes
SunadhRaj.Malaka June 8, 2023
input="/<PATH>/PROJ_KEY-PLAN_KEY.txt"
username="admin"
password="****"

while read -r line
do
  echo "$line" 

curl -u "$username:$password" -X DELETE --url 'http://<BAMBOO_URL>/rest/api/latest/plan/$line'

done < "$input"

Where can i run this , in my test sever ,?  as i am new to this bamboo Development team

could you help me out 

0 votes
SunadhRaj.Malaka June 7, 2023
#!/bin/bash
input="/<PATH>/PROJ_KEY-PLAN_KEY.txt"
username="admin"
password="****"
######################################
# Script to remove plans in bulk # 
#####################################
while read -r line
do
  echo "$line" 

curl -u "$username:$password" -X DELETE --url 'http://<BAMBOO_URL>/rest/api/latest/plan/$line'

done < "$input"

1. in input which path I need to mention, 

2. Proj_Key-Plan_Key.txt we need to download from data base ?

3. if we should download from database how we can delete from server with help of .txt file ?

4. what is this line about ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events