28

I just ported over a repo from GitHub to BitBucket. Although it does many of necessities, I'm finding it surprisingly difficult to find documentation for creating a git commit hook.

Originally I had a ruby app on a CentOS server that was triggered by a GitHub hook. Does anyone know how to achieve the same in the BitBucket environment?

Thanks!

Edit: here's what the ruby app simply looks like if it helps:

post '/' do
  `rm -rf repofolder`
  `git clone https://[email protected]/user/repo.git`
  `sh fast_deploy.sh`
end
1
  • 1
    I wrote this answer to a similar issue a while ago. It is focused on Jenkins+BitBucket, but the blogs referenced there may give you some info. Hope it helps. Commented Mar 3, 2015 at 17:24

2 Answers 2

20

I was able to find a solution. Although John Percival's answer is right, no current support for Ruby, the notification mechanism works.

The code for the Ruby app is in the question. Notice how it looks for a post via post '/' do. I was able to find support to send a POST to a URL in this neat find here: http://read-the-docs.readthedocs.org/en/latest/webhooks.html

Given that info, I was able to create a POST hook in BitBucket via:

  1. Go to repo "admin" tab
  2. Select "services"
  3. Create a POST service to a special port on my URL http://server.com:4567/
Sign up to request clarification or add additional context in comments.

Comments

6

Take a look at https://confluence.atlassian.com/display/BITBUCKET/Write+brokers+%28hooks%29+for+Bitbucket

It looks like the BitBucket folks may not support Ruby, they do support a notification mechanism.

UPDATE: https://confluence.atlassian.com/display/BITBUCKET/Manage+Webhooks#ManageWebhooks-create_webhook

3 Comments

"We are no longer accepting new brokers. Please refer to the information below about using the POST service."
I think : confluence.atlassian.com/display/BITBUCKET/… will get to the same end state
yeah the first link is no bueno no more :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.