You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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.
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 ,
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.