Adding commit metadata

Bitbucket Server provides a number of places plugins can display extra information about a commit, in fact we do precisely that with JIRA integration and build status.

Adding to the UI

Bitbucket Server adds commit metadata in a few places, the commits list (viewable in pull requests and general repository browsing) and commits (usually navigated to by clicking a commit hashed id link).

Commits list

For both JIRA integration and build status we conditionally add a column to the commits list in Bitbucket Server. Plugins can do the same by by adding a web section for the column to "bitbucket.commits.extras".

Commit view

Bitbucket Server allows you to extend the commit page using a web panel extension point. We do this ourselves for the JIRA integration using the "bitbucket.commit.related-entities" extension point. You take a look at the extension points available for yourself by navigating to a commit and appending "?web.panels" to the URL for example ""

Storing metadata

We use a few different methods to store the data we show in the UI.

Commit Indexer

The commit indexer manages whether or not you have seen a commit before and provides a way of storing a small amount of data against a commit. Bitbucket Server's JIRA integration uses the commit indexer to be notified of new commits then extract and store JIRA issue keys from the commit messages.

General Data Storage

We usually use Active Objects to store data in plugins, for example in the build status plugin. It is also possible to store simple key-value data in the plugin settings service example

Accessing your data in the UI

There are a few methods to access data from the server, Bitbucket Server's JIRA integration plugin uses a context provider to supply data from the commit index which is used in its soy template.

Our build status plugin uses its own REST endpoint to fetch data on page load. You can create your own REST plugin module to exposing services and data entities as REST APIs. You can use AJAX via jQuery to call your own REST endpoint, there’s really not much to it:

$.ajax(AJS.contextPath() + "/rest/api/1.0/projects", {
        type: "GET",
        success: function(data) {
            //process the returned data
        contentType: "application/json",