Want to create pre-commit (pre-receive) validation hook for BitBucket cloud

We have had several issues due to users editing configuration files in BitBucket (interavctively) and leaving malformed results. We would like to install some sort of validation for these files to prevent them from being accepted. The libraries that would do the validation are easily available in Java but would have to be duplicated from scratch for a non-JVM language.

I spent several days constructing a hook according to available documentation. I tested it by downloading a copy of BitBucket onto my development host and it failed immediately. After sorting out the small amount of accurate documentation from the vast amount of incorrect and/or outdated documentation I finally got it working.

At this point I passed it on to our BitBucket administrator for installation. Of course it didn't work because we are using BitBucket in the cloud which is vastly different from the version I downloaded. It has no place to upload a JAR and apparently wants webhooks, so now I'm figuring I must spin up a server to do something that actually takes two dozen lines of Java.

Worse yet, I'm not seeing any documentation on using webhooks for pre-commit validation. From some other things I've read online it seems like these hooks are designed to notify another application that something has changed. The only "example code" I can find written in Java is two years old.

Is this even possible? If so, is there some example code somewhere, preferably in Java?

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,206 views 8 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you