Creating Custom Tasks for CruiseControl.NET
Once you start putting CruiseControl.NET to production use you'll sooner or later encounter the need for custom build tasks. There's only a limited set of them in the package and Executable Task can only do so much. Unfortunately there is not much information available on development of custom tasks. Your best sources will be:
- Online documentation contains an article on the subject describing the first steps to get you going. It should be your first stop.
- The source of built-in tasks will soon become your best resource.
Apart from that I feel obliged to mention a few of the most important points I've come across during the development of a few custom tasks:
ThoughtWorks.CruiseControl.Core.Util.ProcessExecutor
is a nice little wrapper aroundSystem.Diagnostics.Process
class you'll end up using quite a lot.- You can add your own information to the build log by calling
AddTaskResult
on theIIntegrationResult
instance passed to yourITask.Run
method. There are two overloads available: one accepting aSystem.String
and another one acceptingITaskResult
to which you can pass a newFileTaskResult
instance to quickly include a complete file. - If you're doing any checkins to your source control system as a part of the build you should call the
MarkStartTime
method of yourIIntegrationResult
instance afterwards to prevent triggering another build of the same project by setting the last build start time after the last checkin time. - Make sure you use a unique
ReflectorType
name for your task. The service will just silently fail to start in case of a duplicate value.
This information should make your first attempts at making your own custom task a little easier.