CruiseControl.NET 自动构建版本号
这是一个复杂的问题,所以我希望我能够很好地解释它。
背景
我正在使用 CruiseControl.NET 和 NAnt 自动化构建过程。我遇到的最头痛的是版本号格式和 CruiseControl.NET 在运行构建项目之前需要来自贴标机的标签。
目前,开发人员运行 Visual Studio 2008 来生成调试、发布和自定义版本。这些配置中的每一个都会调用 BuildInc(自定义工具)来读取文件 (version.ver),递增读取的版本号,为可执行属性生成 .rc2 文件,并将新版本写回到 version.ver。显然,version.ver 和 .rc2 发生了变化,需要在开发人员在源代码管理中标记版本之前检查源代码。源代码管理中的标签是版本号,即 1.2.3.4 -> 1-2-3-4。
目前,新的自动构建会触发调用 NAnt 脚本的 CruiseControl.NET 项目。 NAnt 脚本运行 Visual Studio 并将生成版本发布到发布目录。这工作正常,NAnt 脚本能够通过读取 version.ver 来获取以前和新的版本号。问题是让 CruiseControl.NET 标记源并在仪表板上显示标签。新版本号/标签是在构建过程中生成的,要增加的版本号保存在 Visual Studio 项目中的预链接任务参数中。
版本号
版本号采用独特的格式,并且在主干和开发分支上完成的构建之间有所不同。在分支上完成的构建是为了在完成后合并回主干中。
Trunk
- 格式:[Major].[Merge].[Release].00 即 42.01.02.00
- Major:系统编号
- Merge:如果合并分支则递增
- Release:在 bug 修复时递增
分支
- 格式 [Major].00.[Stream]。 [Release] 即 42.00.01.01
- Major:系统编号
- Stream:流编号,将其链接到其他组件以进行增强
- 版本:增加错误修复
数字以零为前缀,即01、02。这与我遇到的任何工具都不能很好地配合。 (我希望改变这一点)
问题
毕竟我希望你理解我的问题。
- 我可以对自动化流程进行哪些总体改进?
- 您认为在开始构建之前应该知道版本号吗?
- 自动构建系统是否应该自动增加版本号?
- 我应该考虑更改版本号格式吗?
- 还有其他意见吗,我真的需要更多意见。
如果需要更多信息,请告诉我。
注释
语言是C++,平台是Windows,源代码控制是CVS。
This is a complicated one, so I hope I explain it well enough.
Background
I'm in the process of automating a build process with CruiseControl.NET and NAnt. The biggest headache I'm encounting is version number format and CruiseControl.NET requiring the label from a labeller before running a build project.
Currently a developer runs Visual Studio 2008 to produce a Debug, Release and Custom build. Each of these configurations invoke BuildInc (a custom tool) that reads a file (version.ver) increments the read version number, generates an .rc2 file for the executable properties and writes a new version back to version.ver. Obviously version.ver and .rc2 change and need checking backing into source before the developer labels the release in source control. The label in source control is the version number i.e. 1.2.3.4 -> 1-2-3-4.
Currently the new automated build triggers a CruiseControl.NET project that invokes a NAnt script. The NAnt script runs Visual Studio and publishes the builds to a release directory. That works fine, the NAnt script is able to get the previous and new version number by reading version.ver. The problem is getting CruiseControl.NET to label the source and display the label on the dashboard. The new version number/label is generated during the build and which number to increment is held within the Visual Studio project in the pre-link tasks arguments.
Version numbers
Version numbers are in a unique format and are different between builds done on trunk and a development branches. Builds done on a branch are for enhancements that are merged back into trunk when completed.
Trunk
- Format: [Major].[Merge].[Release].00 i.e. 42.01.02.00
- Major: System number
- Merge: Incremented if a branch is merged
- Release: Incremented on bug fixes
Branch
- Format [Major].00.[Stream].[Release] i.e. 42.00.01.01
- Major: System number
- Stream: Stream number, linking it to other components for the enhancement
- Release: Incremented on bug fixes
Numbers are prefixed by zero i.e. 01, 02. This doesn't play well with any tools I'm encountered. (I'm hoping to change that)
Questions
After all that I hope you understand my problems.
- What general improvements could I make to the automated process?
- Do you think the version number should be known before the build is started?
- Should the automate build system auto increment the version number?
- Should I consider changing the version number format?
- Any other comments, I really need more opinions.
Let me know if more information is needed.
Notes
Language is C++, platform is Windows and source control is CVS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以向项目添加构建后事件,该事件会将最新的构建号(以您想要的任何格式)写入源文件夹中的文本文件(例如 label.txt)。
然后添加一个 fileLabeller 类型标签以获取最新版本号,该版本号将从 label.txt 中获取版本号。
You can add a post build event to your project which will write the latest build number (in whatever format you want) to a text file, say label.txt, in your source folder.
Then add a fileLabeller type labeling to get the latest version number which will take the version number from label.txt.