CruiseControl中Bootstrapper与ModificationSet的理解

问题:然后一个 developer SVN 上传变更, CruiseControl 发现了变更并更新本地文件,但是没有启动编译工作,为什么?

[cc] 四月 -01 18:07:52 jectController- TestCruiseControl Controller: build progress event: bootstrapping

[cc] 四月 -01 18:07:53 VNBootstrapper- U    src/Main.java

[cc] 四月 -01 18:07:53 VNBootstrapper- U    bin/Main.class

[cc] 四月 -01 18:07:53 VNBootstrapper- Updated to revision 52 .

[cc] 四月 -01 18:07:54 Project       - Project TestCruiseControl:  checking for modifications

[cc] 四月 -01 18:07:54 jectController- TestCruiseControl Controller: build progress event: checking for modifications

[cc] 四月 -01 18:07:56 Project       - Project TestCruiseControl:  No modifications found, build not necessary.

[cc] 四月 -01 18:07:56 Project       - Project TestCruiseControl:  idle

[cc] 四月 -01 18:07:56 jectController- TestCruiseControl Controller: build progress event: idle

[cc] 四月 -01 18:07:56 Project       - Project TestCruiseControl:  next build in 30 seconds

答:这与 CruiseControl 的实现机制有关。在使用 SVN 时, CruiseControl 基于时间来判断本地版本是否需要编译。但是比较时,是用变更项在 SVN 服务器上的变更时间和 CruiseControl 服务器上最近一次 build 的时间进行比较:

CruiseControl在使用SVN做为配置管理服务器时,<modificationset>基于如下语句判断是否有变更项。

static List<Modification> filterModifications( final Modification[] modifications, final Date lastBuild) {

   final List<Modification> filtered = new ArrayList<Modification>();

   for ( final Modification modification : modifications) {

      if (modification. modifiedTime .getTime() > lastBuild.getTime()) {

            filtered.add(modification);

      }

   }

   return filtered;

}

if (modification. modifiedTime .getTime() > lastBuild.getTime()) 这句话就是判断 SVN 服务器上的变更时间是否大于 CruiseControl 服务器上最近一次编译的时间,如果 SVN 服务器上的变更时间大于最近一次编译的时间,就认为应该进行编译。

bootstrapper 执行检出, modificationset 只是检查在最近一次成功编译到当前时间为止 ( CruiseControl 服务器时间计 ) SVN 服务器上是否有最新版本,如果有最新版本就进行编译。

 

  • SVN 服务器的时钟慢时:

 

 

SVN 服务器比 CruiseControl 服务器慢 2 小时,当 CruiseControl 服务器在 0 点成功地进行了一次编译后, SVN -2 点到 0 点之间有变更提交, CruiseControl 服务器会检出变更,但发现它们的变更时间小于 CruiseControl 服务器上最近一次 build 的时间,就不会执行编译。在 SVN 服务器的 0 点后提交更新时, CruiseControl 服务器检出更新,发现变更时间大于 0 点,就开始执行编译。从而开始新一轮上述循环。

 

  • SVN 服务器的时钟快时:

 

 

SVN 服务器比 CruiseControl 服务器快 2 小时,当 CruiseControl 服务器在 -2 点成功地进行了一次编译后, SVN 服务器在 0 点到 2 点之间有更新, CruiseControl 服务器的 BootStrapper 会检出更新,但是 ModificationSet CruiseControl 服务器时间查询 -2 点到当前时间 (0 点以前 ) 的变更时,查不到 SVN 服务器上 0 点以后的的变更,所以不会执行编译。要到 CruiseControl 服务器也到了 0 点以后,当 ModificationSet 执行检查的时间大于 SVN Server 上的变更时间时,才会查到变更,从而执行编译。

 

综合以上二种情况, SVN 服务器慢于 CruiseControl 服务器时,如果没有新提交,那么有可能 SVN 服务器上的变更一直不能编译;当 SVN 服务器快于 CruiseControl 服务器时,变更一定会编译,但要等到 CruiseControl 服务器的时间大于变更时间。因此在使用时,最好将二个服务器时间调得一致,或 SVN 时间略快于 CruiseControl 时间,以保证变更及时得到编译。

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值