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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

23,815 views 26 12
Join discussion

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