0

I am admin of bitbucket. My team is working to create a company wide automated audit for all the repositories in bitbucket and run some validations on commit or push. To initiate this audit, we want to develop an admin plugin which should keep listening for all the commits/push for repository and make external API call if developer push or merged changes to any repository. This AP will trigger automated audit process which is outside of bitbucket.

I was going through Atlas bitbucket plugin development and felt that I can only develop plugin at repository level. But my requiremnet is for entire stash repository.

Can someone help?

joy
  • 3,669
  • 7
  • 38
  • 73

1 Answers1

1

Take a look at the documentation

However, some hooks need to be enabled for all repositories, without the option of disabling them. This can be achieved by adding the configurable="false" attribute to the repository-hook element in atlassian-plugin.xml

<!-- Hook that logs all tags created through the REST API.
This hook is marked configurable="false" to enable it globally.
The hook won't be listed in Repository > Settings > Hooks and cannot be disabled -->
<repository-hook key="tag-creation-hook" name="Tag Creation Logging Hook" configurable="false"
 class="com.atlassian.bitbucket.server.examples.TagCreationLoggingHook" />
Yuri G.
  • 4,323
  • 1
  • 17
  • 32
  • Thanks, I realized that its possible to create plugin for this purpose. I found more helpful discussion on this topic at https://jira.atlassian.com/browse/BSERV-3382?focusedCommentId=475026&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-475026 – joy May 03 '18 at 17:36
  • NP. Just note that this conversation is pretty old and there was a major change in hooks API in BB 5.0 – Yuri G. May 03 '18 at 17:49
  • You mean I should be using `PostRepositoryHook` instead of `PostReceiveHook`? – joy May 03 '18 at 18:16
  • Yes, PostReceiveHook is deprecated – Yuri G. May 03 '18 at 18:26
  • Please see if you can help on other issue as well https://stackoverflow.com/questions/50165483/bitbucket-api-postrepositoryhook-is-not-invoked-on-pull-request-merged – joy May 04 '18 at 00:26