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.ProcessExecutoris a nice little wrapper aroundSystem.Diagnostics.Processclass you'll end up using quite a lot.- You can add your own information to the build log by calling
AddTaskResulton theIIntegrationResultinstance passed to yourITask.Runmethod. There are two overloads available: one accepting aSystem.Stringand another one acceptingITaskResultto which you can pass a newFileTaskResultinstance 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
MarkStartTimemethod of yourIIntegrationResultinstance 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
ReflectorTypename 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.
