Tuesday, July 3, 2007

Banging with cruiseControl

Cruise control,
I’ve done a cruise control setup . Subversion and cruisecontrol are integrated. My cruise control picks up the repository files from the subversion and builds the war file automatically for every 10(configurable) mins. Please follow the same steps. Use the binary mode file rather than using exe installation.
1) download cruisecontrol-bin-2.6.2.zip from http://sourceforge.net/project/showfiles.php?group_id=23523&package_id=16338&release_id=502915
2) set CVS_RSH=http://test.com/repos/Tree/TESTCMS – at cruisecontrol.bat
3) modify the project name in config.xml as TESTCMS
4) create TESTCMS header folder cruisecontrol-bin/projects/TESTCMS
5) Map the TESTCMS header with repository.(it will pull automatically all other files during ant build)
6) Set the interval in the config.xml
7) place the build.xml under TESTCMS
8) run the cruisecontrol-bin-2.6.2 >> cruisecontrol.bat
I am using the same build script where you are using for CMS. But I’ve modified only root directory as TESTCMS from cms
In addition to these, need to add the below in config.xml under tag:
Install the SVN.exe if not installed.
Change the project name in config.xml tag.
Create a folder with the project name in projects folder of CC
Deploy the webapp of CC in tomcat and control the Cruise.
A sample config is below:
<cruisecontrol>
<project name="TESTCMS">
<!-- Load environment variables -->
<property environment="env" toupper="true"/>
<!-- Commonly used directories -->
<property name="reportdir" value="${env.CCDIR}/report"/>
<!-- Defaults for email -->
<property name="buildmaster.email" value="test@test.com"/>
<property name="buildmaster.name" value="Buildmaster"/>
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
</listeners>
<bootstrappers>
<svnbootstrapper localWorkingCopy="projects/${project.name}" />
</bootstrappers>
<modificationset quietperiod="30">
<svn localWorkingCopy="projects/${project.name}"/>
</modificationset>
<schedule interval="7200">
<ant anthome="apache-ant-1.6.5" buildfile="projects/${project.name}/build.xml"/>
</schedule>
<log>
<merge dir="projects/${project.name}/target/test-results"/>
</log>
<publishers>
<onsuccess>
<artifactspublisher dest="artifacts/${project.name}" file="D:\TESTRelease\sandeep\cruisecontrol-bin-2.6.2\projects\TESTCMS\pmd_report.html"/>
<artifactspublisher dest="artifacts/${project.name}" file="D:\TESTRelease\sandeep\cruisecontrol-bin-2.6.2\projects\cms\build\war\TESTCMS.war"/>
</onsuccess>
<htmlemail>
<always address="test@test.com"/>
<!-- <failure address="tommy@test.com"/> -->
</htmlemail>
</publishers>
<plugin name="svn" classname="net.sourceforge.cruisecontrol.sourcecontrols.SVN"/>
<plugin name="svnbootstrapper" classname="net.sourceforge.cruisecontrol.bootstrappers.SVNBootstrapper"/>
<plugin name="htmlemail"
buildresultsurl="http://172.16.152.126:7070/cruisecontrol/buildresults/${project.name}"
mailhost="IP adress of mail host"
returnaddress="${buildmaster.email}"
returnname="${buildmaster.name}"
subjectprefix="[BUILD ${project.name}]"
/>
</project>
</cruisecontrol>
Tips and traps:
cruisecontrol-bin-2.6.2. integrating with SVN may be tricky.
You need to install SVN client first. Note that the plugin provided by cruise control for
SVN just calls the SVN.exe file using exec call.
Initially the SVN checkout wont work. This is deu to a bug in the SVN plugin by cruise control. The bug is something related to characters in cmd parameter.
Work around is to do a manual checkout using svn.exe co <path> . Then onwards the cruise control rocks.
Another thing to note is to put the below in cruisecontrol.bat
set CVS_RSH=<path to SVN>
There seems to be a bug in this bat file also.Like single quote not compatible with XP..Be aware
One can integrate PMD with SVN just by adding the build task in build.xml. The artifact can be pointed by specifyin the destination

No comments: