Missed Team ’24? Catch up on announcements here.

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

Atlassian Python API - how to retrieve commit associated with a build ?

Naren March 10, 2022

 

We are a Atlassian Shop. We use Bamboo, Bitbucket, Confluence and Jira. I am trying to find out which commit/commits are associated with particular build.

 

I am trying to find out what Bitbucket commit is associated with my Bamboo Build.

 

http://<base url>/rest/api/latest/result/<build key>

 

It retrieves information minus commit. I see the commit information through the GUI.

Is there an API that can retrieve the commit information ?

thanks

 

 

1 answer

1 accepted

0 votes
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 10, 2022

Hello @Naren

Welcome to Atlassian Community!

To find the associated revision (commit/PR) for a nominated build you can use the following API syntax:

/result/{projectKey}-{buildKey}-{buildNumber : ([0-9]+)|(latest)}?expand&favourite&start-index&max-results

Then look for the value of "vcsRevisionKey".

https://docs.atlassian.com/atlassian-bamboo/REST/8.1.3/#d2e4105

For example, considering my project is ABC, the plan is NOP and Build is 31:

$ curl -k -s -u admin:admin -X GET -H "Accept: application/json" https://bamboo.mydomain.net/rest/api/latest/result/ABC-NOP-31 | jq -r ".vcsRevisionKey"
2c357d05bac57c09bdc588f5380d8fff25bf8693

 

Regards,

Eduardo Alvarenga
Atlassian Support APAC

Naren March 11, 2022

Thanks Eduardo

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 11, 2022

Hey @Naren please let us know if we can go ahead and close this thread by accepting this answer as a solution for this case.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events