代码改变世界

.NET环境下每日集成(3):CruiseControl.Net配置

2008-04-23 14:31  敏捷的水  阅读(3787)  评论(2编辑  收藏  举报

1.要想使用CruiseControl.Net进行每日集成,必须对其进行必要的配置,配置文件是安装目录下的CCNet.Config
2.他是一个xml文件

<cruisecontrol>
    
<project .. >
    
</project>

    
<project .. >
    
</project>

    .
    .
</cruisecontrol>

就是说我们可以管理多个project
其中<project>...</project>的结构如下

<project name="Project 1" queue="Q1" queuePriority="1">
    
<workingDirectory>yourWorkingDirectory</workingDirectory>
    
<artifactDirectory>yourArtifactDirectory</artifactDirectory>
    
<category>Category 1</category>
    
<webURL>http://server1/ccnet/server/local/project/testProject/ViewLatestBuildReport.aspx</webURL>
    
<modificationDelaySeconds>2</modificationDelaySeconds>
    
<triggers>
        
<yourFirstTriggerType ../>
        
<yourOtherTriggerType ../>
    
</triggers>
    
<state type="yourStateManagerType" ../>
    
<sourcecontrol type="yourSourceControlType" ../>
    
<labeller type="yourLabellerType" ../>
    
<prebuild>
        
<yourFirstPrebuildTask ../>
        
<yourOtherPrebuildTask ../>
    
</prebuild>
    
<tasks>
        
<yourFirstTask ../>
        
<yourOtherTask ../>
    
</tasks>
    
<publishers>
        
<yourFirstPublisherTask ../>
        
<yourOtherPublisherTask ../>
    
</publishers>
    
<externalLinks>
        
<externalLink name="My First Link" url="http://somewhere/" />
        
<externalLink name="My Other Link" url="http://somewhere.else/" />
    
</externalLinks>
</project>

节点名称- 解释 类型 必须 默认值
name 项目的名称,必须是唯一的,名字可以随便起,最好能代表项目的意思,比如office, 等等 string yes n/a
queue 就是集成的队列名字 string no the project name
queuePriority 队列的优先级,比如多个项目同时做集成,那个级别高,那个就先编译。 string no 0
workingDirectory 集成的工作目录,后面的需要设地址的,可以以这个作为相对目录 string no WorkingDirectory
artifactDirectory 集成的日志 string no Artifacts
webURL 集成报告的URL string no http://localhost/ccnet
category 集成的目录,集成报告中显示 string no empty string
modificationDelaySeconds 源码修改后延迟多少秒执行集成 integer no 0
sourcecontrol 源码控制器配置,从哪里获得源码 Source Control Block no Null Source Control Block
triggers 引起集成编译的触发器 List of Trigger Blocks no  
state 集成状态管理 State Manager Block no Project State Manager
labeller 标签块,发布版本的标签,集成报告中用 Labeller Block no Default Labeller
tasks 一些列顺序执行的任务 List of Task Blocks no empty list
prebuild 编译之前顺序执行的任务 List of Task Blocks no empty list
publishers 编译成功后执行的任务 List of Task Blocks no  
externalLinks Dashboard中附加的一些链接 List of ExternalLinks no empty list

 

3. 下面是我的测试项目的配置

<cruisecontrol>
<project name="TestProject">
     
<workingDirectory>E:\dailybuild</workingDirectory>
        
<artifactDirectory>E:\dailybuild</artifactDirectory>
        
<category>TestProject</category>
    
<sourcecontrol type="vsts" autoGetSource="true"  applyLabel="false">
          
<server>http://tfs1.TestProject.com:8080</server>         
          
<domain>TestProject.com</domain>
          
<project>$/TestProject projects/Analysis and Design\Concierge\Prototype</project>
          
<workingDirectory>E:\dailybuild\TestProject</workingDirectory>
          
<cleanCopy>true</cleanCopy> 
    
</sourcecontrol> 
<tasks>
<msbuild>
  
<executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
  
<workingDirectory>E:\dailybuild\TestProject\Solution\TestProject</workingDirectory>
  
<projectFile>TestProject.sln</projectFile> 
  
<logger>E:\dailybuild\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
  
<targets>Build</targets>
  
<timeout>900</timeout>
</msbuild>
<buildpublisher>
     
<sourceDir>E:\dailybuild\TestProject\Solution\TestProject\PrecompiledWeb\WEB</sourceDir>
     
<publishDir>E:\dailybuild\publish</publishDir>
     
<useLabelSubDirectory>false</useLabelSubDirectory>
</buildpublisher>
<!--<email from="dailybuild.jack@gmail.com" mailhost="smtp.gmail.com" mailhostUsername="dailybuild"
mailhostPassword="123456654321"  includeDetails="TRUE">
    <users>
        <user name="jackwang" group="buildmaster" address="testuser@TestProject.com"/>
        <user name="JoeDeveloper" group="developers" address="wangdeshui@gmail.com"/>
    </users>
    <groups>
        <group name="developers" notification="change"/>
        <group name="buildmaster" notification="always"/>
    </groups>
</email>
-->
</tasks>
<triggers>
        
<intervalTrigger name="continuous" seconds="600" buildCondition="IfModificationExists"/>       
</triggers>
<labeller type="dateLabeller" />
</project>
</cruisecontrol>

4. 要想记录编译日志,我们还必须下载

ThoughtWorks.CruiseControl.MSBuild.dll,地址是:http://ccnetlive.thoughtworks.com/MSBuildXmlLogger-Builds/ 
把它放到我们的Projecte的<workingDirectory>目录下(示例是E:\dailybuild)

下篇我们将对几个复杂类型的配置节进行介绍