Tutorial
The goal of this page is to illustrate IvyCruise plugin integration into cruise control.
It is a roadmap to install your IvyCruise plugin into your CruiseControl system. If you already have a CruiseControl environment and only want to know how to install IvyCruise, follow this link
The projects : we have 3 projects A, B, C.
We set up a workspace to launch cruise control, the workspace is defined into : C:\dev\cruisecontrol\launch.
In this dir we find :
For our example, the project can be written like this :
Here are the parameters we use in our example.
It is a roadmap to install your IvyCruise plugin into your CruiseControl system. If you already have a CruiseControl environment and only want to know how to install IvyCruise, follow this link
1. Setting up environment
The roadmap uses a fresh install of CruiseControl 2.2.1 and a functional development environment using ivy.Ant
We have deployed an Ant 1.6.2 version, ANT_HOME is set, PATH is modified to access bin directory in ANT_HOME, last ivy.jar and ant-contrib.jar are in the lib dir of ANT_HOME.Ivy and projects
We have configured our projects to use ivy :- ivy configuration in : C:\dev\ivy\conf
- ivy cache in : C:\dev\ivy\cache
- a local repository to publish artifacts into in : C:\dev\ivy\repository
The projects : we have 3 projects A, B, C.
- A has no dependencies
- B depends on A
- C depends on B
CruiseControl
CruiseControl 2.2.1 is installed into : c:\dev\cruisecontrol\cruisecontrol-2.2.1We set up a workspace to launch cruise control, the workspace is defined into : C:\dev\cruisecontrol\launch.
In this dir we find :
cc.bat -> a batch launcher to cruisecontrol (adds ivy libs into cruise path) set CCDIR=%CRUISE_HOME%\main set CRUISE_PATH=.\lib\ivy.jar;.\lib\ivycruise.jar %CCDIR%\bin\cruisecontrol.bat -port 8000 -rmiport 1099 %*The important things in this batch file, are the add-on of the libs into cruise path and the set of rmiport that enables JMX on CruiseControl (if rmiport is not set, IvyCruise will run in a degraded but functionnal mode).
WARN : in order to allow modifications of CruiseControl classpath (normal for adding pluggins !), we need to modify the file "cruisecontrol.bat".
Change line :
set CRUISE_PATH=%JAVA_HOME%\lib\tools.jar;with
set CRUISE_PATH=%JAVA_HOME%\lib\tools.jar;%CRUISE_PATH%;and delete line
set CRUISE_PATH=
config.xml -> the cruise control config file build-A.xml -> an ant build launcher for our A project (make CVS update and call our "cruise" target) build-B.xml -> an ant build launcher for our B project (make CVS update and call our "cruise" target) build-C.xml -> an ant build launcher for our C project (make CVS update and call our "cruise" target) lib -> a lib dir where we put ivy.jar, ivycruise.jar artifacts -> the dir where cruise copies artifacts checkout -> the dir where we have checked out the projects to build with cruise logs -> heu! what is this dir for ? ;-)
The basic CruiseControl config file
First of all, we need a multithreaded CruiseControl server that uses our plugins. Here is how to declare the plugins used, and set-up the multithreaded server.<cruisecontrol>
<plugin name="ivybuilder" classname="fr.jayasoft.ivy.cruise.IvyBuilder" />
<plugin name="ivybuildstatus" classname="fr.jayasoft.ivy.cruise.IvyBuildStatus" />
<plugin name="ivyconditional" classname="fr.jayasoft.ivy.cruise.IvyConditionalPublisher" />
<system>
<configuration>
<threads count="2" />
</configuration>
</system>
</cruisecontrol>
<plugin name="ivybuilder" classname="fr.jayasoft.ivy.cruise.IvyBuilder" />
<plugin name="ivybuildstatus" classname="fr.jayasoft.ivy.cruise.IvyBuildStatus" />
<plugin name="ivyconditional" classname="fr.jayasoft.ivy.cruise.IvyConditionalPublisher" />
<system>
<configuration>
<threads count="2" />
</configuration>
</system>
</cruisecontrol>
Set up without ivycruise plugin
Now we set up the config.xml file of cruise control to manage basically our projects. Each entry for each project should look like this :<project name="A" buildafterfailed="false">
<bootstrappers>
<currentbuildstatusbootstrapper file="logs/A/buildstatus.txt" />
</bootstrappers>
<modificationset quietperiod="0">
<cvs localworkingcopy="checkout/A" />
</modificationset>
<schedule interval="31536000">
<ant antscript="c:/dev/ant/apache-ant-1.6.2/bin/ant.bat" buildfile="build-A.xml" target="build" uselogger="true">
</ant>
</schedule>
<log dir="logs/A" />
<publishers>
<currentbuildstatuspublisher file="logs/A/buildstatus.txt" />
</publishers>
</project>
<bootstrappers>
<currentbuildstatusbootstrapper file="logs/A/buildstatus.txt" />
</bootstrappers>
<modificationset quietperiod="0">
<cvs localworkingcopy="checkout/A" />
</modificationset>
<schedule interval="31536000">
<ant antscript="c:/dev/ant/apache-ant-1.6.2/bin/ant.bat" buildfile="build-A.xml" target="build" uselogger="true">
</ant>
</schedule>
<log dir="logs/A" />
<publishers>
<currentbuildstatuspublisher file="logs/A/buildstatus.txt" />
</publishers>
</project>
2. Adding IvyCruise plugins
If you already had a CruiseControl installation, just verify that you have enable JMX and added correct libs in CruiseControl environment, see it here and here.Integration project & ivybuilder plugin
First we need to create a project that will manage the projects build order, relatively to Ivy dependencies. This project uses the first IvyCruise plugin : ivybuilder.For our example, the project can be written like this :
<project name="integration" buildafterfailed="false">
<bootstrappers>
<currentbuildstatusbootstrapper file="logs/integration/buildstatus.txt" />
</bootstrappers>
<modificationset quietperiod="0">
<alwaysbuild />
</modificationset>
<schedule interval="120">
<ivybuilder>
<project name="A" ivyfile="checkout/A/ivy.xml" />
<project name="B" ivyfile="checkout/B/ivy.xml" />
<project name="C" ivyfile="checkout/C/ivy.xml" />
</ivybuilder>
</schedule>
<log dir="logs/integration" />
<publishers>
<currentbuildstatuspublisher file="logs/integration/buildstatus.txt" />
</publishers>
</project>
<bootstrappers>
<currentbuildstatusbootstrapper file="logs/integration/buildstatus.txt" />
</bootstrappers>
<modificationset quietperiod="0">
<alwaysbuild />
</modificationset>
<schedule interval="120">
<ivybuilder>
<project name="A" ivyfile="checkout/A/ivy.xml" />
<project name="B" ivyfile="checkout/B/ivy.xml" />
<project name="C" ivyfile="checkout/C/ivy.xml" />
</ivybuilder>
</schedule>
<log dir="logs/integration" />
<publishers>
<currentbuildstatuspublisher file="logs/integration/buildstatus.txt" />
</publishers>
</project>
ivybuildstatus plugin
We integrate it into each project that has to be managed by the integration project. The ivybuildstatus is required to tell CruiseControl if the project needs to be build due to a dependency change, a dependent project that we have declared in latest.intregration mode that has changed.<modificationset quietperiod="0">
<ivybuildstatus ivyfile="checkout/B/ivy.xml" />
<cvs localworkingcopy="checkout/B" />
</modificationset>
<ivybuildstatus ivyfile="checkout/B/ivy.xml" />
<cvs localworkingcopy="checkout/B" />
</modificationset>
ivyconditional plugin
The ivyconditionnal plugin is used to avoid spam when using email publishers (or other publishers).Here are the parameters we use in our example.
<publishers>
<ivyconditional>
<email mailhost="127.0.0.1" buildresultsurl="http://127.0.0.1:8080/cruisecontrol/buildresults/myproject/" returnaddress="someone@mysite.com">
</email>
</ivyconditional>
</publishers>
<ivyconditional>
<email mailhost="127.0.0.1" buildresultsurl="http://127.0.0.1:8080/cruisecontrol/buildresults/myproject/" returnaddress="someone@mysite.com">
</email>
</ivyconditional>
</publishers>