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 Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,911 views 7 10
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