AIDA: Badoo’s journey into Continuous Integration
Sunday, October 13, 2013 at 8:35PM
Badoo Development in Git, automation, continuous integration, deployment, release engineering, testing

It’s hardly news to anyone that product development and testing involve a lot of boring routine work, which can lead to human error. To avoid complications stemming from this, we use AIDA.

AIDA (Automated Interactive Deploy Assistant) is a utility that automatically performs many of the processes in Git, TeamCity and JIRA.

In this post, we focus on how through using AIDA we were able to automate multiple workflows and create a scheme of continuous integration.

We’ll start by looking at the version control system (VCS) we use here at Badoo, specifically how Git is used to automate creation of release branches, and their subsequent merging. Then we’ll discuss AIDA’s major contribution to both JIRA integration and TeamCity.

Git flow

The Badoo Team uses Git as a version control system. Our model ensures each task is developed and tested in a separate branch. The branch name consists of the ticket number in JIRA and a description of the problem.

BFG-9000_All_developers_should_be_given_a_years_holiday_(paid)

A release is built and tested in its own branch, which is then merged with the branches for completed issues. We deploy code to production servers twice a day, so two release branches are created daily.

Names of release branches are simple:

build_{name of the component}_{release date}_{time}

This structure means the team immediately knows the date and time of release from the branch name. The hooks that prevent changes being made to a release branch use the same time-stamp. For example, developers are prevented from adding a task to a branch release two hours before deploy to production servers. Without such restrictions the QA team wouldn’t have time to check all the tasks on the release branch.

Our master branch is a copy of production. As soon as a code from ‘Build’ is deployed to servers, it is merged to the master branch. Devs also deploy hot fixes to production servers from this branch.

The scheme we use is shown below:

Six stages of testing

If a task in the release contains an error we remove its branch from the release branch with Git rebase. We use a special script that performs this operation in semi-automatic mode. 

Note:

We don’t use Git revert in release branches. If we removed a task from the release branch with Git revert, after the release was merged into the master, the developer of the problematic task would have to revert the commit in order to get his or her changes back.

AIDA and Git

Due to the sheer number of branches in the described model, a lot of issues arise concerning merge, release and code-control. These can be solved automatically:

Deploy Dashboard

For hot fixes to production servers, we use patches. Applying a patch to the master branch and release branch takes place in semi-automatic mode. For this we use our tool Deploy Dashboard.

Deploy Dashboard is a special web interface for data collection, monitoring and recording, as well as formalisation of patches with a full list of information, and automatic notification.

If we need to fix something in production, the developer creates and attaches the patch. Then the release engineer checks and applies it to the master branch in the central repository. Following this the patch will deploy to our production servers.

AIDA and JIRA

To monitor development, testing and formation of a release we use JIRA. Workflow is planned in detail and fully formalised. Some work in the bug-tracking system is performed by AIDA. Basically, AIDA functions to move tasks or display particular information about them.

Here are a few examples:

AIDA tells us about all actions that have been performed with tasks.

This automation greatly simplifies workflow and eliminates routine activities.

Continuous integration

Earlier, we wanted to get rid of routine activities related to the assembly and automatic deployment to a test environment, but were stuck with manually assigning new names to the branches of each release in the project’s CI-server. Now TeamCity catches changes in all branches on a given mask (in this case mask build_ *) and starts the build.

Consider the process of automatic assembly and deploy in the test environment:

1. The project is set up in TeamCity for a branch with a mask build_ *.

2. If there’s a new change in the release branch, TeamCity starts automatic build.

3. If successful, the script will start deploying to the test servers.

4. With the rapid smoke-test (using a simple curl) AIDA checks the release in the test environment.

5. If the tests don't pass, the release version is marked as bad and is rolled back to the previous (good) version of the release.

The entire process takes three minutes. Tests reveal only fatal errors.

In this case, all unit-, auto- and functional tests are run in parallel.

This is done in order for the tester to be able to see the task in the test environment ASAP.

In Summary

To review what processes are automated using AIDA:

1. AIDA works with Git, creating branches, merging them and warning us when something goes wrong.

2. It starts automated tests and provides a convenient report in Jira.

3. AIDA deletes the task from release in semi-automatic mode.

4. It interacts with JIRA, automatically changing status and updating the information in tasks.

5. AIDA uses a system of patches in semi-automatic mode for hot fixes in a special web interface.

6. It works with TeamCity, running scripts, tests and deploys on the test environment.

If you are interested in reading a more detailed report on each type of automation, please comment and we’ll be happy to continue our series of articles on this subject.

P.S Create good assistants, which won’t let you down when you’re in a pinch!

Vladislav Chernov, Release engineer, Badoo

Article originally appeared on (http://highscalability.com/).
See website for complete article licensing information.