1

I want to prevent from bitbucket to merge PR if there are not enough approvers. I know that this can be done with the premium user but I don't have one so I am trying to find a workaround.

So I was looking into hooks that might do the trick. However, as fa r as I understand githooks in my repo won't do the trick because they are client hooks. Am I right about it?

Also, I don't have access to the bitbucket server to add their server-side hooks.

can it be done with some webhook using a Jenkins job?
Any helpful reference, tip or other solution are welcome.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
Hein
  • 11
  • 1

1 Answers1

0

As you mentioned you will need one of the following:

Admin user

Admin user will allow you to set up the required approvers enter image description here

Access to the file system

Also, I don't have access to the bitbucket server to add their server-side hooks.

Once you have access to the filesystem you can add your hooks.

Git hooks

Once more you are right, local git hooks runs on the client-side.

Here is a sample for server-side hook which you will need to use if you was able to pre-receive hook


Trying to manage the PR form Jenkins might work but its a wrong approach since anyone with the right access can merge the PR form within the bitbucket (Web, source tree, cli etc).

Here is one way to do it with Jenkins:
https://mohamicorp.atlassian.net/wiki/spaces/DOC/pages/209059847/Triggering+Jenkins+on+new+Pull+Requests

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • thanks for the response. so basically the correct way is through the file system(or the premium user) but because I don't have any of those I can't enforce a merge check – Hein Jan 01 '20 at 11:41
  • Exactly. you need admin user for any of those changes – CodeWizard Jan 01 '20 at 11:53