Missed Team ’24? Catch up on announcements here.

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

Bitbucket plugin - get data from Bamboo build plan

Jan Kubalek May 20, 2018

I have Bitbucket Server and own instance of Bamboo. Users are stored in Jira.

I am writing plugin for Bitbucket (change build status against set of Bamboo plans [not all plans must pass, ...]).

Now, I can modify commit build status by plugin API. I Wrote simple plugin (by hint in my previous question)

Now I need get build plan results from linked Bamboo instance (eq - Bamboo is linked with my Bitbucket instance).

How can I obtain informations fom linked Bamboo from Bitbucket plugin I create?

Can I use standard Bamboo API in Bitbucket plugin? (So I can use SecurityService for access to Bamboo data, because Bamboo and Bitbucket are linked and users are maintained by Jira?)

Thanks for any advice :).

1 answer

1 accepted

1 vote
Answer accepted
Kristy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 23, 2018

You can use the BuildStatus API to get build status' and build summaries for commits that have already been sent to Bitbucket. But, if that doesn't have the data you need, then you can use the ApplicationLinkService to get the Bamboo link and from there you can use the ApplicationLink to get the details you need (e.g. create a request from the request factory and use that to get data from the Bamboo endpoint you need)

 

Hope this helps!

Kristy

Jan Kubalek May 28, 2018

@Kristy Thanks for reply. It works without problems :).

I have question about ApplicationLinkService class. Specially getPrimaryApplicationLink(...).

I cannot find ApplicationType implementation for Bamboo. How I can use ApplicationLinkService.getPrimaryApplicationLink(...) function? Where I can obtain ApplicationType I need?

Jan Kubalek May 28, 2018

I found not optimal solution

 ApplicationLink app_link = null;
for(ApplicationLink link: applink_service.getApplicationLinks()) {
ApplicationType type = link.getType();
if(type instanceof BambooApplicationType) {
app_link = applink_service.getPrimaryApplicationLink(type);
break;
}
}
if(app_link == null)
return;
Kristy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 28, 2018

Have you tried:

applink_service.getApplicationLinks(BambooApplicationType.class)

or

applink_service.getPrimaryApplicationLink(BambooApplicationType.class)

 

Kristy
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 28, 2018
Jan Kubalek June 1, 2018

Thank You. I guess it works. (I use Java only for Atlassian plugins and Atlassian configurations).

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events