Integrating CruiseControl with Phing
CruiseControl is a continuous integration tool written in Java -- and tightly integrated with Ant by default. This document describes how you can also use CruiseControl to invoke Phing build scripts. The Phing builder plugin and these instructions are both a work in progress. Please report bugs you find with either using the ticket tracker.
The Phing Builder Plugin
There is a Phing plugin for CruiseControl, which is derived from the Ant plugin. The Phing builder plugin is distributed with CruiseControl in 3.6.2 (see http://jira.public.thoughtworks.org/browse/CC-613); however, if you have an older version of CruiseControl you can install & configure this plugin manually.
To install the plugin, simply download it and place it in your cruisecontrol/main/lib/ directory, or some other location that you know will be on your CLASSPATH when you run CruiseControl.
Using the Builder Plugin
Here is a sample CruiseControl config.xml that calls a Phing build file.
<cruisecontrol buildafterfailed="true"> <plugin name="phing" classname="net.sourceforge.cruisecontrol.builders.PhingBuilder"/> <project name="myproject"> <modificationset> <svn localworkingcopy="checkout/myproject-trunk"/> </modificationset> <schedule interval="60"> <phing target="build" uselogger="true" usedebug="false"/> </schedule> <log dir="logs/myproject-trunk"/> <listeners> <currentbuildstatuslistener file="logs/myproject-trunk/buildstatus.txt"/> </listeners> </project> </cruisecontrol>
This reference is based on the official CruiseControl reference for the Ant plugin.
|buildfile||No (defaults to build.xml)||Path to Phing build file.|
|target||No||Phing target(s) to run. Default is "", or the default target for the build file.|
|multiple||No||Build index used to run different builders. For example, if this is set to 3, the builder will be run every 3 builds. Default value is 1. Can't be set if time is set.|
|time||No||Time in the form HHmm. Can't be set if multiple is set.|
|day||No||Valid values are (case-insensitive) the English names for the days of the week (Sunday, Monday, Tuesday, etc). Does not support multiple days except for the default of every day.|
|tempfile||No||Name of temp file. Defaults to log.xml|
|phingscript||No (cannot be specified if phinghome attribute is also specified||Absolute filename of script (shell script or bat file) used to start Phing. You can use this to make CruiseControl use your own Phing installation. If this is not specified, the PhingBuilder assumes that Phing is installed on your include_path.|
|phinghome||No. Cannot be specified if phingscript attribute is also specified.||Directory in which Phing is installed. CruiseControl will attempt to use the standard Phing execution scripts (i.e. phing.bat or phing).|
|phingWorkingDir||No||Will invoke phing in the specified directory.|
|saveLogDir||No||If supplied a copy of the phing log will be saved in the specified directory. Example: saveLogDir="/usr/local/dev/projects/cc/logs"|
|timeout||No||Phing build will be halted if it continues longer than the specified timeout. Value in seconds.|
|uselogger||No||'true' if CruiseControl should call Phing using -logger; 'false' to call Phing using '-listener', thus using the loggerclass as a Listener. uselogger="true" will make Phing log its messages using the class specified by loggerclassname as a Phing Logger, which can make for smaller log files since it doesn't log DEBUG messages (see useDebug and useQuiet attributes below, and the Phing manual). Set to false to have Phing echo messages to console using its DefaultLogger, which is useful when debugging your Phing build. Defaults to 'false' to make initial setup easier but setting it to 'true' is recommended for production situations.|
|loggerclassname||No (defaults to phing.listener.XmlLogger)||If you want to use another logger (or listener, when uselogger="false") than Phing's XmlLogger, you can specify the classname of the logger here. The logger needs to output compatible XML, and the class needs to be available on the classpath at buildtime.|
|usedebug||No||If true will invoke phing with -debug, which can be useful for debugging your phing build. Defaults to 'false', cannot be set to 'true' if usequiet is also set to 'true'. When used in combination with uselogger="true", this will result in bigger XML log files; otherwise, it will cause more output to be written to the console by Phing's DefaultLogger.|
|usequiet||No||If true will invoke phing with -quiet, which can be useful for creating smaller log files since messages with a priority of INFO will not be logged. Defaults to 'false', cannot be set to 'true' if usedebug is also set to 'true'. Smaller logfiles are only achieved when used in combination with uselogger="true", otherwise there will just be less output echoed to the console by Phing's DefaultLogger.|