Bitbucket is a centralized development management solution for controlling your repositories behind the firewall. It allows you to simplify the procedures of hosting an internal source code control server and provide easy access to your repositories for all your team members.
In the IT world, it is not a secret that Bitbucket can be integrated with other software products and platforms into a single ecosystem that makes the entire development process comprehensive and convenient. Most times, people integrate Bitbucket with Jira. But localization and resolution of the issue is not the only problem, which a generic development encounters every day, several times a day. But it is more important to preserve the project integrity while adding modifications or corrections into the program code. For these purposes, you can use the continuous integration server that can also create project builds and run a series of tests for automatic verification of functionality.
Bitbucket provides out-of-box integration with the Atlassian native solution – Bamboo. But besides Bamboo, there are other CI solutions that are also quite popular – TeamCity and Jenkins. In our blog post, we will outline the specifics of integrating Bitbucket and TeamCity.
REST API as an integration point with Bitbucket
Since times when Bitbucket received support for REST API, it has become much easier to work with and develop custom solutions for it. Now there are several add-ons that allow you to integrate the continuous integration with Bitbucket and get information about status of builds. While viewing commits in the repository, you can instantly see the status of the build or seamlessly proceed to TeamCity for identifying the issues occurred in the particular commit, or just download the latest version of the application for the customer.
Tools to integrate TeamCity and Bitbucket
On the Internet you can find two add-ons for TeamCity that can be used for integration with Bitbucket. Commit Status Publisher is being developed by JetBrains, the other – TeamCity Stash Integration – is being developed by the developer known as mendhak. Both add-ons have proved to be reliable tools for integrating TeamCity and Bitbucket. Let’s review both of them and find their pros and cons.
Installing add-ons in TeamCity
Installation of the add-ons in TeamCity is quite simple and is performed in a normal way as described in documentation. Just upload ZIP-archives with the add-ons through the administration console of TeamCity, then restart the server and that’s done. Apps are available and ready to show you the necessary data.
Commit Status Publisher from JetBrains
First of all, we would like to present the native add-on from the developers of TeamCity because native integration tools are usually convenient, well-thought, and rich in features. You need to configure the build in TeamCity and enable the transfer of its status to Bitbucket. For this purpose, you need to add a Build Feature with Commit status publisher type, which becomes available after installation of the add-on. Complete the configuration of connection to Bitbucket.
Once the configuration is complete, run the application build and ensure that Bitbucket received data from TeamCity.
When you click the build icon, the form with information about the project, configuration and build number is opened. You can see the number of passed and ignored tests.
TeamCity Stash (Bitbucket) Integration from mendhak
Configuration of the add-on is similar to the one from JetBrains. After installation, a new build feature becomes available – Report build status to Atlassian Bitbucket. Unlike the add-on from JetBrains, there are more settings. For example, you can mark the canceled builds as failed in Bitbucket, or you can show the status of the latest build for each instead of showing all statuses for each commit.
Which add-on to choose?
It is necessary to point out that these two add-ons are quite similar. They use Bitbucket REST API for fetching the status of builds. Installation and configuration of both add-ons is quite simple. Pros for the native add-on from JetBrains include compatibility with future TeamCity versions, the instant release of the add-on update with the release of TeamCity, and support from the well-known development team. TeamCity Stash Integration add-on has a bit more functions and detailed instructions to configure the add-on. Which add-on to choose depends on your requirements and personal preferences.