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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,812
Community Members
 
Community Events
176
Community Groups

Bitbucket Cloud Rest API: Trace a PR to Deployment

Hi All,

I want to calculate the lead time of a change i.e. amount of time between pr merged to develop and release.

I have explored the results "Get Deployment" & "List & Get PR" endpoints, but I am not able to trace PR to a deployment. I can see that in the UI but it is not obvious how to do it via that API. Can someone please shed some light on this topic? The docs for the rest APIs are pretty much useless.

Thanks,

1 answer

0 votes
Patrik S Atlassian Team Jun 30, 2022

Hey @Muffadal Hamid ,

Thank you for reaching out to Atlassian Community.

I think the normal path to achieve this would be to call the Get Pull Request endpoint, which would return the hash of the merge commit in the field merge_commit, and then query the List Deployments endpoint for this commit.

However, I'm afraid the Deployments endpoint currently does not support filtering, so you would not be able able to filter directly using the API. We have already a feature request to implement filtering/sorting to this endpoint : 

I would suggest you to add your vote there and add yourself as a watcher in case you want to receive first-hand updates from that ticket.

As an alternative, until filtering is not implemented in that endpoint, you could use an external tool, like jq, to filter the returned deployments JSON for the merge commit. The caveat of this is that you would have to iterate through all the pages from the Deployments endpoint to get all the deployment records, before applying the filter in an external application.

Thank you @Muffadal Hamid ,

Kind regards,

Patrik S

Thanks, @Patrik S for your response. Is there a report that I run on a weekly basis rather than using APIs?

Hey @Muffadal Hamid ,

I'm sorry to say there's currently no native Bitbucket report to trace PRs to a deployment.

There are, however, some third-party plugins on the Marketplace, such as Awesome Graphs for Bitbucket, that can provide you some reports/analyses on the repo, but I don't think they currently track deployments.

In this case, the way to get this information would be indeed through the public Bitbucket API, once the feature BCLOUD-18729 is implemented, and you can do filtering/querying in the deployments endpoint.

Kind regards,

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events