1

As the title says, I have an existing local hook that is written in ruby. I'd like to move this hook server side. I've had a look through the bitbucket addons but didn't see anything that would allow me to run the ruby script.

Is there some way to accomplish this?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user5754
  • 147
  • 1
  • 7

1 Answers1

0

A hook runs in whatever language its shebang instructs it to:

#!/usr/bin/env ruby

See for instance "Slaying dragons with git, bash, and ruby".

The only issue here is that a pre-push hook is a client-side hook, not a server-side: you can declare hooks in a BitBucket server, but none would be a pre-push one.
The article "How to create a simple hook in Bitbucket Server" do mention the hooks folder in its bare repos it is managing, so you can try and put it there, but I doubt it would be triggered.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • You should be able to translate a pre-push hook into a pre-receive hook, though. – Jim Redmond Nov 03 '17 at 17:10
  • Thanks for the response. The hook works fine client side. I currently have a server-side pre-receive hook to check commit messages, and I was hoping there would be an easy way to run the pre-push hook in a similar way. – user5754 Nov 05 '17 at 22:39