Hello,
I am trying to set up a merge check script that will reuse an existing pre-commit git hook in my repository(from the ".git/hooks" folder) and if the hook returns the ok status I will allow the merge.
From my understanding the ".git/hooks" folder is only local so I will upload the hook somewhere in the repo if that is needed.
My main goal is to check if that hook returns OK when someone is trying to merge into the main branch because that will be easier for newcomers that do not have the hook setup locally.
Also some way of checking the hook on the server side when they are pushing would help.
Is there any way to achieve this behavior using Scriptrunner or maybe other basic git functionalities?
Thank you!
Firstly I'd like to clarify if you are using Bitbucket Cloud or Bitbucket Server/DC?
I ask, because the tags for this Community question are for both Bitbucket Cloud and ScriptRunner. However ScriptRunner is currently only compatible with Bitbucket Server/DC.
If you are using Bitbucket Server/DC, then the ScriptRunner for Bitbucket team would first recommend you try and rewrite your local pre-hook as either a server-side custom pre-hook or merge-check using ScriptRunner.
The documentation for a custom pre-hook can be found here: https://docs.adaptavist.com/sr4bib/6.25.0/features/script-pre-receive-hooks/custom-pre-receive-hooks
And the documentation for a custom merge-check can be found here: https://docs.adaptavist.com/sr4bib/6.24.0/features/script-merge-checks/custom-merge-check
Kind regards,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
Hello,
I do have ScriptRunner in my repository settings so using the pre-hook or merge-check is the way to go, but at the same time I am looking for a way to reuse my existing local hooks in those scripts.
Maybe that could be a good addition to ScriptRunner functionalities.
Thank you for your answer!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your answer.
I'm guessing that currently the issue is that your local hooks are written in a language other than Groovy? And hence require re-writing for ScriptRunner.
It is something we will consider. But for now is not something we currently support.
Kind regards,
Robert Giddings,
Product Manager, ScriptRunner for Bitbucket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is the case, my scripts are in bash/sh.
I marked the question as answered since I got the info I needed.
Thank you for your replies!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.