‘Matrix’ project building with Hudson

The crazy (8 releases in the past 30 days!) Hudson dev team has just introduced a new feature. They call it a ‘matrix project’. The idea is that a configuration would often be common to many builds. Say, one for each operating systems, times each supported JDK, times each supported database environments, etc. You could end up with dozens copies of the same Hudson configuration.

To work around this, it is now possible to specify each JDK we are targeting, plus environments variables. All combinations of parameters are then tested.

Configuration of Hudson Matrix Project

Apart from the JDK configuration, this is simply a matter of variables passed to the build script.

In this example, I specified 3 JDKs, 2 test environments, 2 databases, and 3 operating systems, a total of 36 possible combinations.

Various values for the same parameter are separated by whitespace.The main Console Output for the job looks like this:
At revision 33
no change for svn://localhost/USIL/trunk/ValtechLibrary since the previous build
Triggering db=h2,jdk=JDK1.4.2_10,os=windows,target=developer-env
Triggering db=h2,jdk=JDK1.6.0,os=windows,target=developer-env
Triggering db=h2,jdk=JDK1.5.0_11,os=windows,target=developer-env
Triggering db=h2,jdk=JDK1.4.2_10,os=linux,target=developer-env
Triggering db=h2,jdk=JDK1.6.0,os=linux,target=developer-env
Triggering db=h2,jdk=JDK1.5.0_11,os=linux,target=developer-env
Triggering db=h2,jdk=JDK1.4.2_10,os=macosx,target=developer-env
Triggering db=h2,jdk=JDK1.6.0,os=macosx,target=developer-env
Triggering db=h2,jdk=JDK1.5.0_11,os=macosx,target=developer-env
Triggering db=oracle,jdk=JDK1.4.2_10,os=windows,target=developer-env

while each call is actually of the following form:
mvn.bat -Dos=windows -Ddb=oracle -Dtarget=integration-env integration-test

Hudson Matrix Project in progress

Multiple builds for the same job are summarized in this table (the build in progress is in white; it is actually a blinking blue circle).

All in all, the matrix project is a pretty neat feature. What I’d like to see in the future is the possibility to specify Maven profiles. That’s not directly possible today, as profiles are not specified using normal variables, but rather in this way:
mvn groupId:artifactId:goal -P profile-1,profile-2

Of course, this can worked around using a variable-triggered profile.

For more information on matrix projects, see Hudson’s Confluence site and Kohsuke Kawaguchi’s blog.

About Eric Lefevre-Ardant

Independent technical consultant.
This entry was posted in continuous integration, hudson, java, maven, test. Bookmark the permalink.

1 Response to ‘Matrix’ project building with Hudson

  1. Pingback: ericlefevre » CITCON Brussels 2007: Hudson

Comments are closed.