使用 SVN 自动构建分支
我想要做的是为存储库中的所有分支提供 CI 和自动构建。 我希望这些网络应用程序的每个版本都有自己的项目,并作为虚拟目录(或等效目录)放置在分支站点上。 如果能够创建一个新分支并让它自动启动持续集成和构建过程,那就太棒了。 在 IIS 中添加新的虚拟目录并不是什么大问题,如果其余部分自行到位,我就可以这样做。
例如:
目前,我正在使用 SVN、Nant 和 CruiseControl.Net,但我打开了另一个如果情况需要,持续集成服务器或构建脚本。
What I'm looking to do is have CI and an automated build for all of my branches in a repository. I'd like each build of these web apps to have it's own project and be placed as a virtual directory (or equivalent) on a branches site. This would be great to be able to create a new branch and have it start the continuous integration and build process automatically. Adding a new virtual directory in IIS isn't a big deal, I'm ok with doing this if the rest just puts itself in place.
For Example:
Currently, I'm using SVN, Nant and CruiseControl.Net, but I'm open another continuous integration server or build scripting if the situation demands it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是可以完成的,但很大程度上取决于您的构建脚本。 如果您告诉 cc.net 监视顶级 svn 文件夹,例如您的项目监视器:
http://myserver .com/svn/project 而不是 http://myserver.com/svn/project/树干。 如果 http://myserver.com/svn/project 中发现任何更改,它将启动建造。
现在,由您的构建脚本来确定哪些源已过期或是否需要构建新分支。 构建脚本将为任何新分支创建一个新的 VDir。
另一种选择是拥有一个 cc.net 项目,其设计目的除了向 cc.net 添加新项目外不执行其他任何操作。 (称之为 BranchBuilder 项目)我将利用 cc.net 中的预处理器并拥有一个顶级 .config 文件,其中仅包含主干和每个分支的项目。 分支构建器项目将监视 svn 上的根路径。 如果它看到任何变化,它会查看自上次构建以来是否有任何新分支。 如果有的话,它可以为该分支创建一个 ccnet-branchname.config 文件,创建 vdir,然后使用附加包含更新 ccnet.config 根文件。
更新 ccnet 配置后,cc.net 将识别配置文件已被修改并重新加载配置以添加新的分支项目。 该分支项目将开始运行并构建您的新分支。
This can be done, but alot of it is going to depend on your build scripts. If you tell cc.net to monitor the top level svn folder so for example have you project monitor:
http://myserver.com/svn/project rather than http://myserver.com/svn/project/trunk. If any changes are seen in http://myserver.com/svn/project it will kick off a build.
Now, it is up to your build script to determine what source is out of date or if there is a new branch to build. The build script would create a new VDir for any new branches.
Another option would be to have a cc.net project that was designed to do nothing other than add new projects to your cc.net. (Call it BranchBuilder project) I would leverage the pre-processor in cc.net and have a top level .config file that just included the project for trunk and each branch. The branch builder project would monitory the root path on svn. If it saw any changes it would look to see if there were any new branches since the last build. If there was one, it could create a ccnet-branchname.config file for that branch, create the vdir and then update the ccnet.config root file with an additional include.
After the ccnet config has been update cc.net will recognize the config file has been modified and reload the config adding your new branch project. That branch project would start running and build your new branch.
我不明白真正的问题。 无论如何,我建议你 Hudson (http://hudson-ci.org/)。
它很容易使用。
使用 XML 文件可以轻松配置。
它有远程API。
I do not understand the real question. Anyway I suggest you Hudson (http://hudson-ci.org/).
It's easy to use.
It's easy to configure with XML files.
It has remote API.
我不认为您想要基于分支自动设置持续集成项目。 但是,如果您的分支非常标准并且没有进行大幅更改,那么编写 powershell 脚本(或您喜欢的任何脚本语言)来设置新项目将相当容易。
不过,我质疑这种必要性,当我们在 CC.NET 中进行分支时,只需不到一分钟的时间即可复制主干项目并搜索和替换所需的字段。 我们遇到问题的唯一一次是当我们在构建过程中使用自定义脚本时,如果存在这些脚本,我们也需要修改它们,但任何持续集成系统都会发生这种情况。
I don't think what you want as far as automatic set up of your continuous integration projects based on branching. However, if your branches are pretty standard and not changing to drastically it would be rather easy to write a powershell script (or whatever scripting languiage you prefer) to set up the new projects.
I question the need though, when we branch in CC.NET it takes less than a minute to copy the trunks projects and search and replace the needed fields. The only time we run into issues is when we have custom scripts used during the build, if those exist we need to modify those as well but that will happen with any continuous integration system.