How to show information from Bamboo deployments?
Asked by Sentinel:

Hello,

Currently I'm searching the way of how to gather information like currently deployed (released) version per each environment from Bamboo and show it in Jira board.

Seems, it's can be done through API requests to Bamboo deployments and gathering required information and then transform it somehow and show via Jira custom fields (or another) plugin.

Has anyone has done it before or has some ideas for better (and easier) implementation of this?

Thanks


Answers:
author: Daniel Santos
body: Hi [@Sentinel](/t5/user/viewprofilepage/user-id/3097339)  

Thank you for raising this question. It is a challenging one =\]

It is difficult to find people with the right skills in both apps to do solve the whole puzzle, but I can share with you the Bamboo part.

This is an example of how you could get the **deployment name** and the **deployment id** for a given plan key. You may need it if you don't know what is the deployment id from which you want to gather the data. If you could get the plan key from Jira, this would allow you to move forward to deployments.

```
curl -u <USER>:<PASSWORD> \
-X GET -p <BAMBOO_URL>/rest/api/latest/deploy/project/forPlan?planKey=<PLAN-KEY> \
| jq -r '.[] | "Name: " + .name + "\tdeploymentId: " + (.id|tostring)'
```

Keep in mind that the result is filtered with [jq (command-line JSON processor)](https://stedolan.github.io/jq/).

The second example involves a method to gather the **environment ids**. This one will allow you to get data from specific environments for the deployment you got from the step above.

```
curl -u <USER>:<PASSWORD> \
-X GET -p '<BAMBOO_URL>/rest/api/latest/deploy/project/<DEPLOYMENT_ID>' \
| jq -r '.environments[] | "Name: " + .name + "\tenvironmentId: " + (.id|tostring)'
```

The last example will allow you to get all the **deployment results** for a given environment. You will be able to filter them using a similar method as shared for the examples above:

```
curl -u <USER>:<PASSWORD> \
-X GET -p '<BAMBOO_URL>/rest/api/latest/deploy/environment/<ENVIRONMENT_ID>/results'
```

That is the way you can walk from a plan key to a deployment result using REST APIs. Now you will still need to check the Jira side of things. I don't have a lot of experience in Jira to help you with this one, but if I were you I would start checking the [Jira REST API.](https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#editing-an-issue-examples)  

It is also important to know how you want this to be triggered. Do you expect the update to happen after a Bamboo event or after a Jira event? That will affect when the REST calls will be called and the sequence of events to populate the Jira issue.  

I hope the information shared here at least help you to understand the problem better so you can build a strategy to solve it in case no other community member come with a simpler way to approach it.

comments: author: Sentinel
body: Hi Daniel,

Decided to pick another solution - python with selenium webdriver package to grab content from deployments page. After some transformation the output html file placed in http server (or you can use docker+nginx, copying files into container).

Finally, with a help of Custom Content plugin for Jira inserted http link to server (where my grabbed deployments are kept). Now my custon dashboard with Custom Content plugin shows latest deployments like in Bamboo.

P.S. BTW you need to re-run script regularly to renew deployments information.


author: Daniel Santos
body: Hi [@Sentinel](/t5/user/viewprofilepage/user-id/3097339),

That is a great solution and thank you for taking the time to share it here.  
You found your own way to solve the problem and that is awesome!

Have a good one!


Tags: api

board

custom-field

jira

jira-server

server