Continuous integration

From openSUSE

Contents

Overview

Continuous Integration is a software development method that aims at

  • driving contributors to integrate their work frequently (at least daily)
  • rebuilding the project on every integration
  • detecting errors and problems immediately


Idea

The idea behind Continuous Integration is to help developers and the development team. They should break down their tasks into small pieces that can be integrated easily rather than integrating a big and massive change at once. This will keep the project in a stable state at any time and help the developers to integrate their changes to the project iterative in well defined steps.

To keep the project stable it is necessary to check after every integration if it builds. Well, this could be done by each develper himself, but we are at supporting the developer. So the build process should get automated and furthermore be triggerd by the integrations.


Implementations

Threre already exist a few implementations of systems to achieve Continuous Integration, find a list at Wikipedia.org.


CruiseControl.rb

CruiseControl.rb is a framework written in Ruby-on-Rails. Following the idea of Continuous Integration it monitors the SVN repository of a project and triggers a rebuild on each commit.

If a build fails a notification eMail can be sent to a list of eMail addresses - this should be a mailing list that all project members are subscibed to.

Additionally CruiseControl.rb offers a web interface. The status of all builds can be monitored - currently building jobs and finished ones. Even a rebuild can be requested manually.


Continuous Integration and openSUSE

As a first project the Libzypp team now uses a tool to help the developers using Continuous Integration - others may follow. A server was set up running CruiseControl.rb.

In case of a failing build job a notification eMail is sent to to the zypp-commit@opensuse.org mailinglist.

Adding a project to CruiseControl.rb can be done very quickly. In the working directory of CruiseControl.rb on the server one has to execute the following command:

./cruise add <project-name> -u http://svn.somewhere.org/trunk/<project-name>

The default configuration of a project can be altered editing the file:

./projects/<project-name>/cruise_config.rb

An example configuration looks like this (this is Ruby code):

Project.configure do |project|
  project.email_notifier.emails = ['zypp-commit@opensuse.org']
  project.email_notifier.from = 'zypp-devel@opensuse.org'
  project.build_command = '../build_libzypp.sh'
  project.scheduler.polling_interval = 2.minutes
end


Note:

  • The addressees variable is a list - the sender address is a string.
  • CruiseCrontrol.rb natively supports Rails applications and therefore automatically checks and runs tests the Rails way if no custom build_command is defined. To build other projects than Rails specify the build command. This may be a simple make or a call of a build script. In this case this script is not yet under version control, so it has to be provided manually after adding libzypp project. It is advisable to have anything in version control that is needed to build the project with one single command.
  • The default polling interval is 30 seconds. In order to not stress the server when controlling lots of jobs with CruiseControl.rb it is advisable to increase the interval.


Links