Is there a good way to trigger a webhook from Bitbucket Server whenever a commit is pushed to an open pull request? I am currently using the "Pull Request Opened" webhook event to trigger a CI build (recipient is a Jenkins server), which works well for building newly created PRs. However, there doesn't seem to be an event for when a new commit is pushed to the repository branch that a PR is watching. The "Pull Request Opened" event does not handle this event.
While the Atlassian support page for Bitbucket Server webhooks does not mention this, there is a event for "Pull Request Modified" that is mentioned in a different support page. "Modified" sounds close to what I want, but it doesn't cover a new commit. Here is the description on the Bitbucket Server Webhooks edit page:
A pull request's description, title, or target branch is changed.
Sure enough, testing with the "Modified" event enabled does not trigger a webhook when a new commit is pushed to a PR branch. I'm starting to think that there are only two other methods:
I had to implement a custom web server that acts as a proxy between Bitbucket and the CI server (e.g. Jenkins). I configure Bitbucket to send webhooks to my proxy server instead of Jenkins. The proxy server processes the webhook and determines if the new commit is on a branch that currently has a PR open. If so, it passes on the webhook information to the CI server to trigger the build.
It's quite an annoying work around for something that ought to be an event for webhooks.
Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events