有个项目使用了CruiseControl.NET(以下简称CC.NET)作为持续集成工具,周末抽空研究了一下,发现这款由ThoughtWorks贡献的开源工具功能非常强大,主要体现在下面三个方面:
1)灵活、高可配置性,如:多重组合条件触发、多任务队列策略;
2)兼容目前几乎所有的流行SCM工具,使得多种异构系统能够由CruiseControl.NET统一监控和管理;
3)完善的使用文档,使上手和维护变得容易;
而该项目引以自豪的代码check in触发构建的功能通过CC.NET也很容易实现。之前使用过Hudson,该系统采用主从式架构,使用者通过网页让Master控制Slave动作,由于Master由别的部门管理,出问题后需要联系相关人解决,会有一定的处理延迟,而且安装在构建机上的Slave服务经常崩溃。而CC.NET直接安装在构建机上,配置IIS后可通过网页直接访问,操作维护都较前者容易。由于之前的构建脚本是用VisualBuild实现的,所以不可能再花时间用CC.NET再写一遍。而通过实验得知,其实CC.NET能够以ExecutableTask的形式很好地与VisualBuild集成,目前每小时定时构建、NightBuild和构建成功后触发的自动测试都已经放到了CC.NET上了。
ccnet.config Example:
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<queue name="Q1" duplicates="ApplyForceBuildsReAdd" />
<queue name="Q2" duplicates="ApplyForceBuildsReAdd" />
<project name="AgileBuild" queue="Q1" queuePriority="1">
<category>AutoBuild</category>
<triggers>
<filterTrigger startTime="18:00" endTime="10:00">
<trigger type="intervalTrigger" name="Continuous" seconds="1800" buildCondition="ForceBuild" />
<weekDays>
<weekDay>Monday</weekDay>
<weekDay>Tuesday</weekDay>
<weekDay>Wednesday</weekDay>
<weekDay>Thursday</weekDay>
<weekDay>Friday</weekDay>
</weekDays>
</filterTrigger>
</triggers>
<tasks>
<exec>
<executable>VisBuildCmd.exe</executable>
<buildArgs>E:\GAMEDev\AgileBuilder.bld</buildArgs>
<baseDirectory>D:\VisBuildPro7</baseDirectory>
<buildTimeoutSeconds>3000</buildTimeoutSeconds>
</exec>
</tasks>
</project>
<project name="NightBuild" queue="Q2" queuePriority="1">
<category>AutoBuild</category>
<triggers>
<scheduleTrigger time="23:00" buildCondition="ForceBuild" name="Scheduled">
<weekDays>
<weekDay>Monday</weekDay>
<weekDay>Tuesday</weekDay>
<weekDay>Wednesday</weekDay>
<weekDay>Thursday</weekDay>
<weekDay>Friday</weekDay>
</weekDays>
</scheduleTrigger>
</triggers>
<tasks>
<exec>
<executable>VisBuildCmd.exe</executable>
<buildArgs>"BUILD_OPTION=clientworldeffect" "PACK_TYPE=RAR" E:\GAMEDev\NightBuilder.bld</buildArgs>
<baseDirectory>D:\VisBuildPro7</baseDirectory>
<buildTimeoutSeconds>0</buildTimeoutSeconds>
</exec>
</tasks>
</project>
<project name="NightAutoTest" queue="Q2" queuePriority="2">
<category>AutoTest</category>
<triggers>
<projectTrigger serverUri="tcp://heath-builder:21234/CruiseManager.rem" project="NightBuild">
<triggerStatus>Success</triggerStatus>
<innerTrigger type="intervalTrigger" seconds="60" buildCondition="ForceBuild" />
</projectTrigger>
</triggers>
<tasks>
<exec>
<executable>VisBuildCmd.exe</executable>
<buildArgs>E:\GAMEDev\AutoTest.bld</buildArgs>
<baseDirectory>D:\VisBuildPro7</baseDirectory>
<buildTimeoutSeconds>0</buildTimeoutSeconds>
</exec>
</tasks>
</project>
</cruisecontrol>
References
[1] http://cruisecontrol.sourceforge.net/
[2] http://www.kinook.com/VisBuildPro/