Shadow Merge Commit Build Status — Our Plugin for the Bitbucket Server

4 min read

Shadow merge commit build status is a plugin we developed for the Atlassian Bitbucket Server. It allows monitoring the build status of code that would be in the target branch after a real Pull-Request merge and vetoing the merge if the build fails. It is quite simple, but fills a gaping hole in the functionality required for continuous integration.

We work with large amounts of data, so possible workarounds aren’t a good fit for us — they’re just unable to provide the required performance.

Developing our own plugin turned out to be the best solution for us.

So what does the plugin do?

Starting from Bitbucket Server 7.X, our plugin does build a shadow merge commit, which is its most sophisticated part. The plugin provides a standard git ref to that shadow merge commit so it could be read by a regular CI to make a build.

The end user’s part is to configure CI to read a repo with the given ref to commit, then to make a build, and to post the build status to Bitbucket Server.

After that, the plugin displays that build status on UI and acts accordingly in terms of blocking (vetoing) merge for Pull-Request.

It sees the build status for the shadow merge commit in Pull-Request.

Thus, you can check the build status for the shadow merge commit to be sure the target branch will have good quality after the actual merge.

It facilitates your CI practices on the shadow merge commit.

You can run CI builds on the shadow merge commit to verify the code that will be in the target branch after the real pull-request merge. Commit is rebuilt automatically on any change in source or target branches.

It vetoes pull-request if the shadow merge commit is failed.

The target branch might be highly sensitive (like production/ or release/), so, to avoid its breakages, the plugin blocks merge of pull-request if a build is failed.

On top of that

You can enable automatic merge if no veto on pull-request exists at the moment of any of the following events: pull-request is approved, source branch build status is set, the shadow merge commit build status is set, and the task is resolved or deleted.

The plugin also lets you set an option to delete the source branch upon a successful merge.

Lastly

Since we published the plugin on the Atlassian marketplace, it has become quite popular among teams who work on the Bitbucket server — by December 2021, it was installed 60 times. We received KUDOs from happy users, which fuelled our motivation to continue developing for the benefit of the entire IT community. 

Leave a comment