As usual, the link is:

http://www.javaranch.com/journal/200409/DrivingOnCruiseControl_Part1.html

对于这个最著名的CI工具,我已经使用有一段时间了。但是因为有专门的build engineer所以偷懒到今天才来了解一下这个东西的基础知识。

  • 什么是CI和CruiseControl?

要知道CruiseControl的用途,自然得先明白CI是什么。CI, continuous integration。

Technically, the term "Continuous Integration" means that everyone on the team integrates their changes back into the source repository frequently, verifying that the changes didn't break anything.

而集成+测试由完全自动化的工具完成,开发人员需要做的仅仅是将最新的改动提交至repository。CruiseControl就是这样一个自动化工具。

总的来说CI的目的就是实现 快速开发 + 保证质量。在agile越来越流行的今天,CruiseControl会流行就不足为奇了。

再来看官网上一段关于cruisecontrol的说明。有助于加深理解:

CruiseControl is both a continuous integration tool and an extensible framework for creating a custom continuous build process. It includes dozens of plugins for a variety of source controls, build technologies, and notifications schemes including email and instant messaging. A web interface provides details of the current and previous builds. And the standard CruiseControl distribution is augmented through a rich selection of 3rd Party Tools.

CruiseControl is written in Java but is used on a wide variety of projects. There are builders supplied for Ant, NAnt, Maven, Phing, Rake, and Xcode, and the catch-all exec builder that can be used with any command-line tool or script.

  •  How these Continuous Integration servers are typically set up in a project environment?

很简单。

1, Boxes of developer.

2, Box of repository.

3, CruiseControl server.

当开发人员将代码提交到repository时,CruiseControl就能检测到这种变化,build,execute最新的代码并运行UT,最后将结果以web,email等形式呈现给开发人员。另外build时使用的是Ant。其实就是build.xml脚本。

  • Setting Up the Repository and Working Copies

这里在repository server上build一个最最简单的repositiry by using Subversion.安装完Subversion后:

1. First, we need to create the repository itself:

C:/> svnadmin create c:/cia/repositoryserver/svnrepository 2. Second,创建一个Subversion自己要用的临时工作目录: 
C:/> mkdir tmp/project C:/> cd tmp/project C:/tmp/project> mkdir branches C:/tmp/project> mkdir tags C:/tmp/project> mkdir trunk //这个trunk看着相当眼熟吧?
3. 把代码copy到trunk目录下。 
4. import the directory structure into our repository: 
svn import C:/tmp/project file:///c:/cia/repositoryserver/svnrepository -m "Initial import" 5.这时可以将tmp/project删除了。之后就可以在程序员的机器上checkout代码了。 
  • Getting, Installing and Building CruiseControl

文章中有关于这几个folder的解释,非常重要。

main/bin --contains a batch/shell script for launching the CruiseControl process

main/logs --放置每个项目build结果的目录。每个项目会有自己的子目录。

main/dist --contains the cruisecontrol.jar

Reporting --contains the J2EE web application used for reporting CruiseControl build results online after each automated build.

  • Configuring CruiseControl

接下来的工作就是配置CruiseControl to tell it which projects it need to build and how.

配置文件是config.xml,下面是一个简介:

config.xml的完全参考是:http://cruisecontrol.sourceforge.net/main/configxml.html#project

<cruisecontrol> root element,可以有 project和plugin子节点。

<project> 多个项目是可以有多个project 节点。The <project> element is where you tell CruiseControl what to build, when to build, how to build, and how to report.

<project> element accepts two attributes. attribute name是project的名字。另一个可选的为buildafterfailed 表示build失败后是否继续build,即使没有新代码提交。

<property>  The <property> element is used to set a property (or set of properties) within the CruiseControl configuration file. 一般可以用project.properties and specific.properties。

<bootstrappers> The <bootstrappers> element can be used to list bootstrappers, which are executed before the actual build attempt.

<modificationset> The <modificationset> element is where you specify how CruiseControl should figure out whether a build is needed。 这个貌似就是报表中显示的这次build涉及的代码的更改。

两个attributes:

requiremodification:如果没有代码改变,是否build

quietperiod:代码改动多长时间内不build,为了给程序员充分的提交代码的时间。

we can use the <svn> modificationset task to check whether any changes have been committed to the project associated with our working copy. Under the hood, the <svn> task performs a 'svn log' command to get a list of changes between the last build date and the start of the current build cycle.

注意这个node仅仅是说,在schedule的时间到了以后,参考该node来决定是否起一次build。而不是说,当发现related svn code改变后,就马上起一个build。

There's also a nice little task named <buildstatus> that you can use to trigger your build whenever another CruiseControlled project has had a successful build.

//这个很有用啊,比如build完这个project以后运行itf build。

<schedule> specifies how frequent you want your build cycle to start.

<schedule> takes just one attribute, interval, which represents a duration in seconds that CruiseControl will wait between build attempts.默认5分钟一次,也太短了吧!!

The children of <schedule> are called builders and are used for specifying the 'how' part of our configuration. The built-in builders provided out of the box, <ant> and <maven>, can be used to launch Ant and Maven build scripts, respectively. 这个也很重要!!

<schedule> 并不能单独决定什么时候启动一个build。需要和比如<project>和<modification>结合起来决定。

<log>

<publishers> 自然就是通知开发人员的方式了。可以有file,email,web pages and FTP

配置文件详解:

http://cruisecontrol.sourceforge.net/main/configxml.html

通常打开cc的工作目录可以看到以下文件。
-rw-r--r--   1   16004 May  5 02:58 build.xml
-rw-r--r--   1   6892 May  5 02:58 config.xml
-rw-r--r--   1   47171 May  5 03:23 go.log
-rw-r--r--   1   65 May  5 02:58 go.sh
-rw-r--r--   1   1507 May  5 02:58 specific.properties

最后,launch CruiseControl!!

With the configuration file in place under "main/bin", you can finally launch CruiseControl with the following command:

C:/CruiseControl/main/bin> cruisecontrol
作者说要写的Part 2没有找到。。。
set up the reporting web application -- in Part 2...

CruiseControl简介相关推荐

  1. 面向对象的3个基本对象

    谢谢作者 面向对象的三个基本特征(讲解) 面向对象的三个基本特征是:封装.继承.多态. 封装 封装最好理解了.封装是面向对象的特征之一,是对象和类概念的主要特性. 封装,也就是把客观事物封装成抽象的类 ...

  2. svn增量打包部署_持续集成、持续交付、持续部署(CI/CD)简介

    >>>推荐阅读<<< 1.性能测试学习笔记-场景设计 2.性能测试的重要意义 3.性能分析流程及方法 4.应用系统性能调优之性能分析 概述: 软件开发周期中需要一些 ...

  3. CruiseControl.NET配置

    CruiseControl.NET简介 CruiseControl.NET是.net平台下,一个开源的自动化持续集成工具. 它是一个程序套件,但其核心是一个叫做CruiseControl.NET Se ...

  4. 【转载】Maven简介

    你是否早已厌倦了日复一日的手工构建工作,你是否对各个项目风格迥异的构建系统感到恐惧?Maven这个Java社区事实标准的项目管理工具,能帮你从琐碎的手工劳动中解脱出来,帮你规范整个组织的构建系统.不仅 ...

  5. etcd 笔记(01)— etcd 简介、特点、应用场景、常用术语、分布式 CAP 理论、分布式原理

    1. etcd 简介 etcd 官网定义: A highly-available key value store for shared configuration and service discov ...

  6. Docker学习(一)-----Docker简介与安装

    一.Docker介绍 1.1什么是docker Docker是一个开源的应用容器引擎,基于Go语言并遵从Apache2.0协议开源 Docker可以让开发者打包他们的应用以及依赖包到一个轻量级,可移植 ...

  7. 【Spring】框架简介

    [Spring]框架简介 Spring是什么 Spring是分层的Java SE/EE应用full-stack轻量级开源框架,以IOC(Inverse Of Control:反转控制)和AOP(Asp ...

  8. TensorRT简介

    TensorRT 介绍 引用:https://arleyzhang.github.io/articles/7f4b25ce/ 1 简介 TensorRT是一个高性能的深度学习推理(Inference) ...

  9. 谷粒商城学习笔记——第一期:项目简介

    一.项目简介 1. 项目背景 市面上有5种常见的电商模式 B2B.B2C.C2B.C2C.O2O B2B 模式(Business to Business),是指商家和商家建立的商业关系.如阿里巴巴 B ...

最新文章

  1. Matlab数据的可视化 -- 极坐标图及其与直角坐标图的转换
  2. SQL函数大全——实例
  3. 地理文本处理技术在高德的演进(下)
  4. mysql基本语法 外键_Mysql基本语法一
  5. 加密工具truecrypt 中文版 的加密解密添加文件的方法
  6. WPF 加载Gif动态图片的方法
  7. 计算机号密码保护,如何使用BIOS或UEFI密码保护计算机 | MOS86
  8. 智能家居1 涂鸦开关接入homeassistant
  9. 产品经理如何进行市场分析的知识点
  10. 计算机多核启动原理,多核cpu工作原理 不进来看看?
  11. ABBYY FineReader Server 与杂乱无章的较量。我们的解决方案如何去除重复内容,让商业文档井井有条?
  12. chcp永久修改控制台字符编码
  13. 贪心算法 | 最优装载问题——加勒比海盗船
  14. 计算机物理学论文300字,物理考试反思范文300字(精选6篇)
  15. JQuery和JS怎样实现淘宝购物车的添加和删除?
  16. 数字图像处理 彩色图象处理
  17. PTA 7-23 求序列立方和
  18. Git使用教程,最详细
  19. 软件开发流程关键岗位职责定义
  20. 【程序人生】程序员成长历程的四个阶段

热门文章

  1. 牛客SQL 大厂面试真题 某东商城 6套代码及解析
  2. Ubuntu:截图快捷键
  3. less 命令最基本的用法
  4. 2021.04.06JAVA定义一个数组,随便输入一个数字,判断这个数在数组中是否存在,存在返回数组的下标,否则返回-1
  5. Nanopi 加 小米随身wifi
  6. 通过Gitee克隆仓库加速GitHub下载
  7. github下载老版本的项目
  8. 【视频学习】更自信,气质女生的衣品必修课
  9. 解决html、php中文乱码问题
  10. 北京供销大数据集团落户温江 助力成都打造国家中心城市