Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bitbucket Hooks vs Webhooks

Tags:

bitbucket

What's the difference between hooks and webhooks in BitBucket? I've read the documentation for both but I can't seem to understand when you would use one over the other.

Edit: Documentation that I read.

https://confluence.atlassian.com/bitbucket/manage-webhooks-735643732.html https://confluence.atlassian.com/bitbucketserver/using-repository-hooks-776639836.html

like image 796
Megan Lin Avatar asked Nov 07 '22 01:11

Megan Lin


1 Answers

As ben5556 mentioned, you're comparing Bitbucket Cloud documentation to Bitbucket Server documentation. There's another important distinction here, though: the Bitbucket Server docs you linked refer to git hooks, which are a native part of Git, and the Bitbucket Cloud docs refer to webhooks, which are an HTTP-based callback mechanism. (In the interest of full disclosure, Bitbucket Server can send webhooks as well: https://confluence.atlassian.com/bitbucketserver/managing-webhooks-in-bitbucket-server-938025878.html)

You can't currently control git hooks on Bitbucket Cloud, but on Bitbucket Server (where you'd only break your own stuff) you can use those to control different parts of the git workflow. For example, on BB Server, you can use a pre-receive hook to reject pushes if some commits don't have a ticket number in the commit message, or you can use a post-receive hook to notify your (human) users about upcoming maintenance.

Webhooks are typically used more as a notification method - you can have Bitbucket notify Slack about pull request merges, for example, or have Bitbucket notify your CI/CD system that there are new commits to test.

like image 195
Jim Redmond Avatar answered Dec 22 '22 07:12

Jim Redmond