Monday, June 16, 2008

Hudson and ClearCase

If you want your company to be more agile and want to install a Continuous Integration system, but are stuck on Clear Case, here is a little howto. I am normally a Linux/Unix boy, but Windows was mandated.

Download and install a servlet container such as Tomcat. Secondly, download the Hudson war file. You can (should) define a HUDSON_HOME environment variable. Start Tomcat, deploy the Hudson war to the webapps dir, the "jobs" and "plugins" directories should be created in your HUDSON_HOME directory.

Either use the builtin plugin manager page, or if like me you can't get it to work, download the Clear Case plugin manually and put it in the HUDSON_HOME/plugin directory and restart Tomcat.

Go to http://localhost:8080/hudson/ and choose "Manage Hudson" -> "Configure System". Configure the Cleartool executable home (usually c:\program files\rational\clearcase\bin\cleartool), and other tools/services you might use for your projects (Ant, Maven, SMTP server etc)

Select "New job" -> "Build a free-style software project" and select a name, press "ok".

How to configure stuff here depends on how your Clear Case administrator has set up your system, but this is what worked for me.
Select the "UCM ClearCase" radio button and configure the following fields:
View name - select a new unique view name, for instance "hudson_myproject". This is the view that Hudson will create for you.
Stream selector - this is very project dependent, this is how I figured out my stream name: If you have the ClearCase Explorer tool, select "Toolbox" tab -> "UCM" dropdown -> "Join project" link -> select your project -> "Properties" button. Now directly under the project name you see a string somewhat like the following:
project:myproject_1.0@\servername
Then the following should be your stream name:
myproject_1.0@\servername
If you have checked out a project view before with CC Explorer manually to the default drive (usually M:) you can go to M: with Windows Explorer and rightclick on the directory there and select ClearCase tab, then properties. You should be able to get the Stream string from there too.
Load rules - Backslash + the path to a VOB (database file containing the project) just under the root of the project view. Again, if you have previously created a view using ClearCase explorer and mapped it to drive M:, go to M: and open the view directory there. Select one of the subdirs there as your "load rule". For example, I had
M:\myproject\src
so my "load rule" became
\src

Now press "advanced" button in Hudson config, and configure the following:
Additional mkview arguments - Here I had to use the -vws parameter to the mkview command, plus a UNC name. Something like this:
-vws \\companynetwork\clearcaseviewsserver\AD\myusername\
This is where Hudson will create the view directory, but the source itself will be checked out to, and built from, your HUDSON_HOME/jobs/jobname/builds/ directories.

7 comments:

Anonymous said...

Do you know how to tell hudson to not create any view but use the dynamic view that I already have in the M: drive?

Lars Westergren said...

@Sanjay - I don't think you can do that unfortunately. It seems that the plugin always want to create its own view to work with.

You can't select an existing view name for instance, if you try, it will complain no matter if you configure "Base" or "UCM" style ClearCase. Also, mkview always runs on the command line output first time you do a Hudson build.

redsolo said...

@redsolo, sanjay

The plugin do support using a dynamic view in base CC. It is available in the advanced section of the configuration.

But I would like to say that using a dynamic view is not how Hudson is designed to work. Most of the reporting plugins expect that the files are located under the workspace folder. Its also much safer to use snapshot views, and dynamic views can change during a build.

dilipm79 said...

On RHEL 4, I have got tomcat working, but deploying hudson.war in tomcat's webapps home doesn't work.

root 29454 1 5 20:24 pts/7 00:00:09 /opt/IBMJava2-142/bin/java -Djava.endorsed.dirs=/opt/tomcat/common/endorsed -classpath /opt/IBMJava2-142/lib/tools.jar:/opt/tomcat/bin/bootstrap.jar:/opt/tomcat/bin/commons-logging-api.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start

I get error:
HTTP Status 404 - /hudson/

type Status report

message /hudson/

description The requested resource (/hudson/) is not available.

Lars Westergren said...

dil - Check Tomcats server log, there was probably an exception when it tried to deploy Hudson.war. It seems you are using Java 1.4? May be that Hudson or its dependent libs uses features from later Java versions.

Balaji said...

I want to build a project but it is dependant on another project in another stream.
Any idea how it can be done?

Darren Demers said...

If you have checked out a project view before with CC Explorer manually to the default drive (usually M:) you can go to M: with Windows Explorer and rightclick on the directory there and select ClearCase tab, then properties. You should be able to get the Stream string from there too.
gold shawls and wraps , shawl wholesale online , prom shawl , embroidered pashmina shawl , pashmina shawls manufacturers , shawl fashion , men's pashmina shawls , best pashmina shawls , buy shawl , pashmina shawl in nepal