CruiseControl Enterprise 最佳实践 (1) : Publish with a Publisher

2024-01-17 13:32

本文主要是介绍CruiseControl Enterprise 最佳实践 (1) : Publish with a Publisher,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

2007年10月12日 01:09:00

?Copyright 2007 Julian Simpson. All rights reserved.

英文原文: CruiseControl Enterprise: 10 Best Practices

I'm an Infrastructure Specialist at ThoughtWorks. In my role I make sure that we are building our software so it can successfully be deployed to production. In this series of blog posts I hope to pass on my top ten tips for using CruiseControl Enterprise effectively. I'm writing these with the developers or systems administrators in mind: the people who most often manage CruiseControl. However, I hope that anybody who is interested in Continuous Integration will get something from these articles.

# 1: Publish with a Publisher : 使用 Publisher 来发布, 而不是在构建过程中发布

许多项目都会用到"发布"的概念: 把构建产物放到指定地方, 或者把测试结果发送给最终用户. ArtifactsPublisher 就是一种很常用的方式, 用来把文件发布到CruiseControl自己的时间戳目录形式的仓库中, 这样构建日志, 构建产物和测试结果等就可以通过新的CruiseControl Dashboard或者传统的CruiseControl Reporting应用展现出来.

ArtifactsPublisher不过是整个 Publisher 家族中的一员, 而我的最爱是 AntPubliisher. 如果你的Ant构建以发布构建产物到仓库中或者给你的版本控制系统打Tag来结束, 那么或许应该用另外的方式来做这些事情. 考虑下面的CruiseControl调用的Ant脚本例子:

>project<
>target name="dist" description="build everything"<
>/target<
>target name="clean" description="delete all build artifacts"<
>/target<
>target name="test" description="run unit tests"<
>/target<
>target name="publish" description="publish to repository"<
>/target<

>target name="cruise" depends="clean,dist,test,publish"/<
>/project<


构建的最后一步是通过 "publish" target 发布通过了单元测试的工作产物到某个仓库或类似的地方. 这对于CruiseControl来说不错, 很好, 但是, "发布"的概念并不真正适合在开发者的构建过程中使用. 如果我们能够断开"发布"和构建过程的其它部分之间的联系, 开发者就能够和CruiseControl使用一模 一样的构建过程. 要想这样做, 只需要让CruiseControl来调用你开发过程中使用的构建脚本, 而把"publish"作为一个独立的Ant target:

>project<
>target name="dist" description="build everything"<
>/target<
>target name="clean" description="delete all build artifacts"<
>/target<
>target name="test" description="run unit tests"<
>/target<

>target name="dev" depends="clean,dist,test"/<

>target name="publish" description="publish to repository" if="logfile"<
>/target<

>/project<

'publish' target 中的 'if' 属性用来保证这个target只会被 publisher 或某个特定的人来运行. 接下来, 只需改动一下CruiseControl的配置:

>!-- some config removed from this example --<

>schedule interval="60"<
>ant antWorkingDir="${checkout.dir}" buildfile="build.xml" target="dev"/<
>/schedule<

>publishers<
>onsuccess<
>antpublisher antWorkingDir="${checkout.dir}" buildfile="build.xml" target="publish"/<
>onsuccess<
>/publishers<



OK, 这就做完了. 一旦你应用了新的配置, CruiseControl就会运行和开发者一模一样的Ant构建. 这意味着构建失败时并不是因为 "CruiseControl" 做了什么神秘的事. 这还有助于通过更快的报告成功或失败来缩短构建的反馈周期. 当开发者在庆祝或郁闷于构建的成功或失败时, AntPublisher 在同一时间继续做着把构建产物发布到网络上的工作. 我还用它来为codebase打tag, 如果构建成功的话--这件事也是"持续集成"的一部分.

Publishers 能够被直接用在配置文件的>publishers <元素中, 这样每次构建结束后无论成功失败都会运行. 也可以包在>onsuccess <或>onfailure <中有条件的运行.>

Publishers 有一个堂兄妹表姐弟叫 Bootstrappers, 我另外找时间说说它.


-----------------------------
我想这个实践的好处就是

1. 开发者每次在自己机器上构建时不需要发布, 省时间
2. CruiseControl使用跟开发者相同的构建脚本, 减少了开发者构建成功而CruiseControl构建失败的概率, 省调试时间
3. CruiseControl运行Publisher时开发者可以继续工作了, 提高了并发性, 还是省时间

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1821028


这篇关于CruiseControl Enterprise 最佳实践 (1) : Publish with a Publisher的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/616213

相关文章

Spring Security简介、使用与最佳实践

《SpringSecurity简介、使用与最佳实践》SpringSecurity是一个能够为基于Spring的企业应用系统提供声明式的安全访问控制解决方案的安全框架,本文给大家介绍SpringSec... 目录一、如何理解 Spring Security?—— 核心思想二、如何在 Java 项目中使用?——

防止Linux rm命令误操作的多场景防护方案与实践

《防止Linuxrm命令误操作的多场景防护方案与实践》在Linux系统中,rm命令是删除文件和目录的高效工具,但一旦误操作,如执行rm-rf/或rm-rf/*,极易导致系统数据灾难,本文针对不同场景... 目录引言理解 rm 命令及误操作风险rm 命令基础常见误操作案例防护方案使用 rm编程 别名及安全删除

C++统计函数执行时间的最佳实践

《C++统计函数执行时间的最佳实践》在软件开发过程中,性能分析是优化程序的重要环节,了解函数的执行时间分布对于识别性能瓶颈至关重要,本文将分享一个C++函数执行时间统计工具,希望对大家有所帮助... 目录前言工具特性核心设计1. 数据结构设计2. 单例模式管理器3. RAII自动计时使用方法基本用法高级用法

PHP应用中处理限流和API节流的最佳实践

《PHP应用中处理限流和API节流的最佳实践》限流和API节流对于确保Web应用程序的可靠性、安全性和可扩展性至关重要,本文将详细介绍PHP应用中处理限流和API节流的最佳实践,下面就来和小编一起学习... 目录限流的重要性在 php 中实施限流的最佳实践使用集中式存储进行状态管理(如 Redis)采用滑动

ShardingProxy读写分离之原理、配置与实践过程

《ShardingProxy读写分离之原理、配置与实践过程》ShardingProxy是ApacheShardingSphere的数据库中间件,通过三层架构实现读写分离,解决高并发场景下数据库性能瓶... 目录一、ShardingProxy技术定位与读写分离核心价值1.1 技术定位1.2 读写分离核心价值二

深入浅出Spring中的@Autowired自动注入的工作原理及实践应用

《深入浅出Spring中的@Autowired自动注入的工作原理及实践应用》在Spring框架的学习旅程中,@Autowired无疑是一个高频出现却又让初学者头疼的注解,它看似简单,却蕴含着Sprin... 目录深入浅出Spring中的@Autowired:自动注入的奥秘什么是依赖注入?@Autowired

MySQL分库分表的实践示例

《MySQL分库分表的实践示例》MySQL分库分表适用于数据量大或并发压力高的场景,核心技术包括水平/垂直分片和分库,需应对分布式事务、跨库查询等挑战,通过中间件和解决方案实现,最佳实践为合理策略、备... 目录一、分库分表的触发条件1.1 数据量阈值1.2 并发压力二、分库分表的核心技术模块2.1 水平分

SpringBoot通过main方法启动web项目实践

《SpringBoot通过main方法启动web项目实践》SpringBoot通过SpringApplication.run()启动Web项目,自动推断应用类型,加载初始化器与监听器,配置Spring... 目录1. 启动入口:SpringApplication.run()2. SpringApplicat

Java整合Protocol Buffers实现高效数据序列化实践

《Java整合ProtocolBuffers实现高效数据序列化实践》ProtocolBuffers是Google开发的一种语言中立、平台中立、可扩展的结构化数据序列化机制,类似于XML但更小、更快... 目录一、Protocol Buffers简介1.1 什么是Protocol Buffers1.2 Pro

linux安装、更新、卸载anaconda实践

《linux安装、更新、卸载anaconda实践》Anaconda是基于conda的科学计算环境,集成1400+包及依赖,安装需下载脚本、接受协议、设置路径、配置环境变量,更新与卸载通过conda命令... 目录随意找一个目录下载安装脚本检查许可证协议,ENTER就可以安装完毕之后激活anaconda安装更