Drone does not support Bitbucket Server (Stash) Pull Requests

I don’t see a PR builds triggered upon opening a PR in BitBucket Server.

How can I debug this? Drone server is running in DRONE_DEBUG=true mode.

Based on output of ‘grep /hook server.log’ I don’t believe a PR hook was received from BitBucket, unless the hook was received but it did not get logged.

Any ideas?


After reading the source code and BitBucket REST API documentation, I believe Drone is using the wrong REST API resource.

Drone currently uses /rest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled, using the PostReceive hook plugin (which will only trigger a call to drone when one does git push but will not generate a Pull Request related call).

Drone should be using the new webhook API: /rest/projects/{projectKey}/repos/{repositorySlug}/webhooks, this API allows one to specify all the different types of events such as push, pull request, etc.

I am not sure if the payload generated by both types of hooks is identical - if so, we can just swap out the REST API calls. I’ll see if I can find out.

Here’s my sample Python code using the requests module to call the webhoosk API. I am not yet a Go person, but I’ll try to see if I can create a Pull Request.

username = "some-user"
password = "some-password"
url = "https://bitbucket.mydomain.com/rest/api/1.0//projects/MYPROJ/repos/drone-test/webhooks"

data = {     u'active': True,
              u'configuration': {u'secret': u'foobar'},
              u'events': [u'pr:reviewer:approved',
              u'name': u'some-name-for-webhook',
              u'url': u'https://some-url/'}

# without this header, Atlassian complains of XSRF
headers = {"X-Atlassian-Token": "no-check"}
r = requests.post(url, json=data, headers=headers, auth=(username, password))

Drone does not support pull requests for Bitbucket Server (aka Stash). Drone only has code in place to create and process push hooks and tag hooks.

Just curious to know if there is any active development around Bitbucket (Pull Request and tag hooks), if someone has already started working on this we can work together to make it available for community. @bradrydzewski Please do share If you have any future road-map to have this feature available in Drone.
I tried to validate the tag hooks with below syntax but it didnt trigger the build.

  event: [tag]	  
  branch: master

@darshandeshmukh11 Honestly the folks I was helping, for which I initially contributed the Bitbucket Server remote moved to gitlab :confused: so I haven’t had any reason to update it. I imagine using the new APIs that support PR hooks which @rvora mentioned is the right way to go (although might need a separate remote for folks on older versions) and I’m totally willing to work with someone to help out… I just no longer have access to a instance of bitbucket server. Also at one point the tag piece worked, so I’m not sure if the apis changed.

Hi @josmo (and @bradrydzewski) , I am learning Go for this purpose (python is my primary language), I want to do a fork and see if I can help create a new remote (to support existing users as you said). I’ll need some help on how to go about the edit-test-debug cycle. I have access to Bitbucket server so that’s not a problem. What I don’t get is which source code files I need to touch after I create a new remote directory by copying existing remote directory. Any pointers?

We have extracted integrations to a separate library, which is replacing the current package in 0.9. I have not had time to port Bitbucket Cloud or Bitbucket Server yet, so any help would certainly be appreciated.

The repository is here: https://github.com/drone/go-scm