Bitbucket Data Center provides events which can be used to hook into SCM hosting operations. Of particular interest for hosting are the push event and the pull event.
Using Bitbucket Data Center events you can respond to user operations which repository hooks cannot. You can also replicate the behavior of global hooks.
MyBitbucketEventListener.java
1 2package com.atlassian.bitbucket.example; import com.atlassian.event.api.EventListener; public class MyBitbucketEventListener { @EventListener public void mylistener(RepositoryPushEvent pushEvent) { // call to your psuedo-hook with pushEvent.getRepository() // and pushEvent.getRefChanges() } }
Note: you won't be able to reject a push or write information back to the client using this method.
Some examples of where we use these events in Bitbucket Data Center:
Responding to application events is detailed here.
Rate this page: