Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Scipting Labels in Bamboo (for historic artifacts)

Tim Finch February 5, 2019

Hi,

 

We are looking to implement the Bamboo Global Expiry policy, but we have been using the tool for a number of years now.

We need to retrospectively apply labels across historic artifacts chosen by our development teams, before we implement the Global Expiry Policy. 

Is there any pain free options for doing this? Scripts? Plugins? that would aid in applying labels across historic artifacts on mass?

Thanks

1 answer

1 vote
Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 5, 2019

You should be able to achieve this via the Bamboo REST API, which supports adding/removing labels from plans/builds - relevant resources are:

As usual, any REST client will do, I'm personally using the free edition of Postman to explore/test an API from the browser and HTTPie for the actual implementation from the command line.

The Bamboo REST API supports both XML and JSON representations, and I think the former is the default, so make sure to request JSON by specifying "Content-Type: application/json" if you prefer this nowadays easier to work with format.

 

Amol Kandurwar August 7, 2019

@Steffen Opel _Utoolity_ I tried following the API doc and I am getting "HTTP Status 415 – Unsupported Media Type, The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource." even if I am passing proper json data with application/json content type.

Request:

curl -X POST -H “Content-Type: application/json” -H ‘authorization: Basic XXXXX‘ -d ‘{“name”:”UTWeekly”}’ https://<Bamboo URL>/rest/api/latest/result/{projectKey}-{buildKey}-{buildNumber}/label

Also tried witth Postman tool and got the same result.

<!doctype html><html lang="en"><head><title>HTTP Status 415 – Unsupported Media Type</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 415 – Unsupported Media Type</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Unsupported Media Type</p><p><b>Description</b> The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.</p><hr class="line" /><h3>Apache Tomcat/8.5.39</h3></body></html>

Amol Kandurwar August 7, 2019

Looks good

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events