The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Server-side pre-commit hook?

Charlie Misonne
Community Champion
April 29, 2020

My questions might sound silly at first but here is what I want to achieve:

Currently we are using a custom pre-receive script written in Perl which does some syntax checking on our pushed files. It has been put in each repository's hooks/post-receive.d/ directory on the Bitbucket server. This is being provisoined by Puppet and works just fine.

HOWEVER users can bypass this hook by using the online Bitbucket editor. Pre-receive hooks are only being triggered on a push. And committing with the online editor does not involve any push.
So I thought I could fix this by using the same script as pre-commit hook on the server side. But apparently pre-commit scripts are not being triggered either when using the online editor.
I know pre-commit hooks are meant to be used client-side but how I see it Bitbucket server is the client when using the online editor.
Anyone knows how to achieve this?

 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Aron Gombas _Midori_
Community Champion
April 30, 2020

I don't think it's gonna work.

We have a Bitbucket app, very similar functionality (commit policy enforced) and the Bitbucket editor does not call the corresponding handlers. At least, it was the status some months ago.

Charlie Misonne
Community Champion
May 4, 2020

Hmm that's a pity. And I don't want to disable the editor because it's useful for some other projects.
Maybe we should use a CI plan instead.

Thanks for your answer!

Aron Gombas _Midori_
Community Champion
May 4, 2020

You may want to accept the answer so that future visitors can see if it was correct even if not an actual solution.

TAGS
AUG Leaders

Atlassian Community Events