Bitbucket Server Plugin Tutorials

This page contains a selection of tutorials for implementing selected plugin points from Bitbucket Server.

Controlling when pull requests can be merged

This tutorial will take you through the steps required to write a plugin containing a Merge Request Check which is designed to prevent pull requests from being merged unless the user performing the merge is an administrator for the target repository.

After completing this tutorial you will have learned to do the following:

  • Generate a Bitbucket Server plugin using Atlassian SDK
  • Implement a merge request check in Java
  • Declare a merge request check in your plugin's atlassian-plugin.xml
  • Use various Bitbucket Server services and the merge request check API
  • Internationalize the messages your plugin emits

Check out the "Controlling when pull requests can be merged" tutorial.

Creating a repository hook (video)

This 30 minute video tutorial will take you through creating, deploying and debugging a simple repository hook plugin using the Atlassian SDK.

After completing this tutorial you will have learned to do the following:

  • Generate a Bitbucket Server plugin using Atlassian SDK
  • Understand the basic structure of an Atlassian plugin
  • Implement a pre-receive hook in Java
  • Start a local development Bitbucket Server server
  • Deploy a Bitbucket Server plugin to your local server
  • Attach a debugger to Bitbucket Server

Check out the "Beer O'Clock Hook" tutorial.

(Note: This tutorial pre-dates the renaming of the product to "Bitbucket Server" from "Stash", but is still a useful resource.)

Decorating the user profile and account pages

Adding custom content to the public user profile, or a user's account management pages is easy! Follow the following tutorials:

Showing related items on a pull request

This tutorial will take you through the steps required to add custom content to the Overview tab of a pull request.

After completing this tutorial you will have learned to do the following:

  • Find plug-in points in Bitbucket Server's UI for adding content
  • Define a Client Web Panel
  • Use custom CSS and JS in your panel with Web Resource dependencies

Check out the "Pull Request Overview" tutorial.