一些关于cruise control的笔记

cruiseControl learning
最近看了些关于持续构建的内容,才知道差了好多,下面是自己的一些记录,可能比较乱,而且也不全是关于cruiseControl的, 希望对大家有用

...........................
一个 continuous integration 工具,能团队进行敏捷开发,每过一段时间来进行集成,以便随时能发现引入的错误。当build失败后,将会通知提交者,使其能够更改代码。

cruiseControl(CC)的配置是围绕六个插件来展开的。

在提交之后,build失败了,如果不希望在再次提交代码之前重复的构建,可以有如下设置  <project name="integration" buildafterfailed="false">
----


1. Bootstrapper: cc创建之前运行,是创建前的准备工作 ....Bootstrappers are run before a build takes place
<bootstrappers> 
  <currentbuildstatusbootstrapper> 指定了状态文件的位置,主要是用来访问项目当前创建的状态
  <cvsbootstrappers> 可以是其他的源码控制系统,.....就是为从源码控制系统更新ant 的 buildfile 文件而设计的.....
  因为我们每次项目的创建都应该基于最新的代码,因此在创建之前就要获得最新的项目文件, 如果你使用的是ant, 这个工作是由ant 的buildfile来完成的。


2. SourceControl:访问源码控制系统,查看源码自上次build之后是否被修改。并据此决定是否需要进行下一次Build
<modificationset>  ,用于检查各个源码控制系统中是否发生变化,<schedule>会用到这里面的配置信息,如果检测到变化,会触发创建过程。



3. Builder:对项目进行创建,(包括对项目源码的的编译,测试,打包)
<schedule>  定时驱动<modificationset>,如果检测到变化,就执行所指定的builder 的任务。
当<modificationset>检测到修改时,如果没有调用build,下次也不会调用build,因为下次没有检测到失败。
但是build失败时,会一直要重新构建,直到构建成功。................??????????
因此build失败后,再此成功时,至少有两次被修改了,即modifications 为2

----------------------------------------------------------------
<schedule interval="60">
      <ant anthome="apache-ant-1.7.0" buildfile="cc-build.xml" saveLogDir="projects/${project.name}" antworkingdir="projects/${project.name}"
target="build" />
</schedule> 
当ant节点的antworkingdir属性设定之后,buildfile的起始位置将是  antworkingdir的位置,切记。(ant应用中)ant调用其他文件时,好像也是样的吧,需要查查
-------------------------------------------------------------


4. LabelIncrementer:对源码打标签,自动增加标签的编号

5. Publisher:发布创建的结果,可以通过email的方式通知开发人员()。。。。


IRCPublisher   将结果发入一irc服务器,需要一个 ircPublicsher插件, http://confluence.public.thoughtworks.org/display/CC/IRCPublisher
--------------------------------
当提交的人提交的内容导致了错误,将发送错误消息给他,配置如下:需要注意的一点是,如果cvs用户名是"Paul wei"形式,用户名之间有空格的,CC只提取前面一部分,作为用户名,所以需要加个<map alias="Paul" address="**@**"
/>
    <publishers>
      <onsuccess>
        <artifactspublisher dest="artifacts/${project.name}" file="projects/${project.name}/target/${project.name}.jar" />
      </onsuccess>
   <currentbuildstatuspublisher file="logs/${project.name}/status.txt" />
     <email mailhost="smtp.host"
        returnaddress="[email protected]"
        skipusers="false"
        reportsuccess="fixes"
        subjectprefix="[CruiseControl]"
        buildresultsurl="http://192.168.0.15:8080/buildresults/integration"
    >
    <map alias="Paul" address="[email protected]" /> 
             </email>
    </publishers>

------------------------------------
6. Listener:用于处理一些项目有关的事件  ???



============================
其他的一些问题,

1.当报下面的错误时: 即ant logfile找不到,
  - exception attempting build in project integration
net.sourceforge.cruisecontrol.CruiseControlException: ant logfile **\log.xml is empty. Your build probably failed. Check your CruiseControl logs.

请往这句话的上面查看,很可能是其他地方出错了,比如构建文件找不到。下面是我曾遇到过的一种情况
2008-04-11 10:21:22,091 [Thread-8 ] INFO  Project          - Project integration:  now building
2008-04-11 10:21:22,091 [Thread-8 ] INFO  ProjectController - integration Controller: build progress event: now building
2008-04-11 10:21:22,857 [Thread-16] INFO  ScriptRunner     - Buildfile: projects\integration\cc-build.xml does not exist!
2008-04-11 10:21:22,889 [Thread-15] WARN  ScriptRunner     - Build failed
下面这个blog是另一种情况,内存不够
http://www.bxm.at/blogs/java/2007/08/19/cruisecontrolexception_ant_logfile_does_
........

2. ant 的cvs如果要执行 add 或者 update等命令时,需要相对路径,绝对路径时会出错。
<cvs cvsroot="${cvsroot}" command="update ../ab/ch.txt" />

......

----------------------------------------
从java development with ant中一些关于cruisecontrol的tips

? CruiseControl recommends that you use Jikes instead of javac because it is
faster and leaks less memory.
? Likewise, if you do use the javac compiler or another big Java program, set
fork="true".
? Get a mobile phone with SMS messaging and set up an email alias, and then
you can get paged when things go wrong—and when they start working again.


猜你喜欢

转载自laorer.iteye.com/blog/183528