Real-time continuous integration use cases

Set up continuous integration is easy in QuickBuild. You just need to set the build necessary condition of the configuration as "effectingRepositoriesModified", and edit schedule setting so that QuickBuild check the repository for changes and trigger the build at your desired frequency. However if you want to implement real time continuous integration (that is, whenever a checkin is made into the repository, QuickBuild should fire the build right away to verify the checkin), you need to go a step further. The basic idea is to install a trigger script at repository side which will be fired when the repository receives a checkin. This trigger will use QuickBuild remote API to trigger manual build in desired configuration. Of course, you won't need to set the configuration schedule to check repository periodically anymore.

The way to install build trigger at repository side varies according to the type of version control system you are using. Below is examples of how to configure such trigger for CVS and Suversion.

Set up real-time continuous integration for CVS

I have a configuration root.myproduct.CI which checks out and build against CVS module module1. Whenever there is a checkin made into the module, I want the build of this configuration to be triggered right away, and send notification to users who made the checkin if there is any build/unit test error.

  1. Create a step of type "send notification" for configuration root.myproduct.CI with the following properties:

    step necessary condition

    Use the default value, that is, this.parent.anyChildStepFailed. With this condition, notification will be sent if the build fails.

    Choose notifier

    Choose proper notifier here

    Select users or groups

    Choose "users who checked in recently" for this property.

    Configure this step into the execution series of the default step and set it as last step to be executed.

  2. Modify the TriggerBuild.java sample, so that it triggers build of the configuration root.myproduct.CI. Of course, you also need to change the login information, and Hessian service URL. Compile this program with jars under api/lib directory (refer to compile.sh and run.sh), and write a script triggerbuild.sh (or triggerbuild.bat if on Windows platform) to run this program with Java.

  3. Checkout "loginfo" file under CVSROOT directory of your CVS repository, and append a line like this:

    module1 /path/to/triggerbuild.sh
    [Note]Note

    Before editing, the file "loginfo" should be checked out first using your cvs client, just like you edit any other files in your cvs repository.

  4. Check in the "loginfo" file. From now on, the checkins under CVS module "module1" will trigger the triggerbuild.sh command, which will result in triggering the build in the configuration root.myproduct.CI, and checkin users will receive build notification if build/unit test failes.

  5. A live demo is available through QuickBuild's demo site http://livedemo.pmease.com:8081. In this live demo, root.realtime-CI stands for the configuration root.myproduct.CI we mentioned here. Just connect to CVS repository using :pserver:anonymous@cvsdemo.pmease.com/home/cvsroot, and make some checkins into the module realtime-CI, you'll see the configuration root.realtime-CI will be triggered and it will run to ensure the health of the code base.

Set up real-time continuous integration for Subversion

I have a configuration root.myproduct.CI which checks out and build against Subversion url svn://myserver/myproduct. Whenever there is a checkin made into the url svn://myserver/myproduct/trunk, I want the build of this configuration to be triggered right away, and send notification to users who made the checkin if there is any build/unit test error.

  1. Create a step of type "send notification" for configuration root.myproduct.CI with the following properties:

    step necessary condition

    Use the default value, that is, this.parent.anyChildStepFailed. With this condition, notification will be sent if the build fails.

    Choose notifier

    Choose proper notifier here

    Select users or groups

    Choose "users who checked in recently" for this property.

    Configure this step into the execution series of the default step and set it as last step to be executed.

  2. Modify the TriggerBuild.java sample, so that it triggers build of the configuration root.myproduct.CI. Of course, you also need to change the login information, and Hessian service URL. Compile this program with jars under api/lib directory (refer to compile.sh and run.sh), and write a script triggerbuild.sh (or triggerbuild.bat if on Windows platform) to run this program with Java.

  3. Create the file post-commit.sh (or post-commit.bat if on Windows platform) under the hooks sub directory of the directory where Subversion repository resides in, and add the following lines if on Unix-like systems:

    #!/bin/sh
    /path/to/triggerbuild.sh

    Or add the following line if on Windows platform:

    /path/to/triggerbuild.bat

    In this way, each checkin made into the repository will trigger configuration root.myproduct.CI. But new build will be generated only when there are changes under url svn://myserver/myproduct/trunk. This is guaranteed by the build necessary condition (should be set as effectingRepositoriesModified of course). If a new build is necessary but can not be compile/unit test successfully, all checkin users will receive the failure notification.