Releases showing 90 commits with custom Bitbucket integration

Hello,

I connected Sentry to Bitbucket so that it has access to commits and such. Following the guide at https://docs.sentry.io/workflow/releases/?platform=php I realized I also needed to notify Sentry of certain events so that it can create and deploy releases. So, I wrote my own webhook script, and added that webhook to Bitbucket. Now Bitbucket calls my script whenever a PR is created and when a PR is merged. Inside the script I’m talking to the Sentry API to create and deploy releases (https://docs.sentry.io/api/releases/post-organization-releases/).

All of this is working, but the issue is associating the correct commits. It seems Sentry always associates the maximum of 90 commits. I have not specified a previousCommit, because this information is not inside Bitbucket’s webhook. This is also the reason why I can’t specify all the individual commits in the PR as again, this information is not inside the webhook body. It only supplies the head commit and some other data.

Here’s a screenshot showing all the releases with 90 commits:

My question is twofold:

  1. Why isn’t the automatic previousCommit detection working? The docs specify that specifying a previousCommit is not required, and that Sentry will automatically determine the previous release’s commit. As a follow-up question, I am also wondering if this method will ever work reliably? Our team works on several hotfixes and features simultaneously, and I’m afraid that using this method one release will end up containing commits belonging to other releases?
  2. Since Sentry is already hooked up to my Bitbucket repo, why doesn’t Sentry offer the option of creating and deploying releases when it detects that a Pull Request has been created or merged in Bitbucket? That would avoid the need for me to maintain my own webhook script and also avoids me from needing to build an OAuth authentication flow to gather the commit data from Bitbucket myself.

Perhaps I’m just doing something wrong, please let me know. In any case, thanks a lot for your help!

Thanks for submitting this, @SeBsZ. I’m going to ping support to help answer this.

Hi @SeBsZ, did you find a solution for this?
I have a similar problem, that sentry only loads the first 25 commits from bitbucket (server): https://github.com/getsentry/sentry/issues/19201

The problem seems is here:


The max-limit of 90 commits is hard-coded.