Wednesday, March 25, 2009

Cruisecontrol usage

Cruisecontrol dashboard can be accessed at the location: http://10.177.135.55:8080/dashboard/tab/dashboard
A reference for creating the config.xml file, which you will need soon, is present at this location:http://cruisecontrol.sourceforge.net/main/configxml.html

You can add a project for automated builds into CC by doing the following steps:

1. Add a project tag to the C:\CruiseControl\config.xml file. There are two types of builds that you may configure:
2a. Build that takes place within a certain interval i.e. hourly build. This usually checks that code checked in by various developers are compiling.
2b. Build that takes place once everyday at the night. This usually checks that the code in the source control compiles and deploys on the appserver. You may run the tests too in this build and build the project site which maven does very well.
2. Checkout the project in the C:\CruiseControl\projects folder of that machine. Yes, you need to manually check out the project in the projects folder for the first time. Later, CC does the updates. But, first, check #3.
3. It is a good idea to have two folders like this: C:\CruiseControl\projects\hourly and C:\CruiseControl\projects\nightly in which you check out the projects.
4. For the project tag of the type in 2a use the following template(The string between ##, including the hashes, is to be replaced with the suitable string):
<project name="#project-name#">
<listeners>
<currentbuildstatuslistener file="logs/#project-name#/status.txt"/>
</listeners>

<bootstrappers>
<!-- This is a sample for subversion source control. This command is different for different source controls. Add as many paths as you want updated.-->
<svnbootstrapper localWorkingCopy="projects/hourly/#the path to the checked out project where svn update needs to take place#" username="#username#" password="#password#"/>
</bootstrappers>

<!--This tag is to specify the paths that you want CC to track changes made in. i.e. If there is any change of a file in these paths a build will be triggered.-->
<modificationset quietperiod="30" >
<!--Again, this is for subversion source control. Add as many paths as you want to track.-->
<svn localWorkingCopy="projects/hourly/#the path to the checked out project where you want CC to detect changes for a build to take place#" username="#username#" password="#password#"/>
</modificationset>

<!--This tag species that changes must be checked every one hour. If changes are detected, then the commands specified must be run, here it is a maven command.-->
<schedule interval="3600">
<!--The maven command to run if a build must take place. This could be an ant command too. Check the CC reference for the right syntax.-->
<maven2 mvnhome="${mvn.home}" pomfile="projects/hourly/#the path to the build file in the checked out project.#" goal="clean install" flags="-e"/>
</schedule>

<publishers>
<currentbuildstatuspublisher file="logs/#project-name#/status.txt"/>
<email mailhost="mail.oracle.com" returnaddress="#build-manager#@oracle.com" buildresultsurl="http://10.177.135.55:8080/buildresults/#project-name#" reportsuccess="never">
<failure address="#dev-team-email-id(s)#@oracle.com"/>

</email>
</publishers>
</project>

5. For the project tag of the type in 2b use the following template(The string between ##, including the hashes, is to be replaced with the suitable string):
<project name="#project-name#">
<listeners>
<currentbuildstatuslistener file="logs/#project-name#/status.txt"/>
</listeners>

<bootstrappers>
<!-- This is a sample for subversion source control. This command is different for different source controls. Add as many paths as you want updated.-->
<svnbootstrapper localWorkingCopy="projects/hourly/#the path to the checked out project where svn update needs to take place#" username="#username#" password="#password#"/>
</bootstrappers>

<!--This tag is to specify the paths that you want CC to track changes made in. i.e. If there is any change of a file in these paths a build will be triggered.-->
<modificationset>
<!--Again, this is for subversion source control. Add as many paths as you want to track.-->
<svn localWorkingCopy="projects/nightly/#the path to the checked out project where you want CC to detect changes for a build to take place#" username="#username#" password="#password#"/>
</modificationset>

<!--This tag species that there is no schedule. So, the time to build is taken from the command. Here, it is 8pm everyday.-->
<schedule>
<!--The maven command to run if a build must take place. This could be an ant command too. Check the CC reference for the right syntax.-->
<maven2 mvnhome="${mvn.home}" time="2000" pomfile="projects/nightly/#the path to the build file in the checked out project.#" goal="clean install" flags="-e"/>
</schedule>

<publishers>
<currentbuildstatuspublisher file="logs/#project-name#/status.txt"/>
<email mailhost="mail.oracle.com" returnaddress="#build-manager#@oracle.com" buildresultsurl="http://10.177.135.55:8080/buildresults/#project-name#" reportsuccess="never">
<failure address="#dev-team-email-id(s)#@oracle.com"/>

</email>
</publishers>
</project>
6. After this step one can go to the CC dashboard and monitor the project builds as well as trigger builds manually.

No comments: