简体   繁体   English

使用 TeamCity 进行颠覆发布管理

[英]subversion release management with TeamCity

We currently use Subversion for our release management, and tag all of our releases (both to QA and to our production servers).我们目前使用 Subversion 进行发布管理,并标记我们所有的发布(包括 QA 和我们的生产服务器)。 However, we'd like to create a single Release directory reflecting our newest release instead.但是,我们希望创建一个单一的 Release 目录来反映我们的最新版本。 This way we can have TeamCity always pull from the same folder for continuous builds.这样,我们可以让 TeamCity 始终从同一个文件夹中提取以进行持续构建。 Also, if someone has to make a quick bug fix to production, they won't accidentally make it to the wrong branch.此外,如果有人必须对生产环境进行快速错误修复,他们不会不小心将其移至错误的分支。

For example, below is our current structure with a 'release' folder added.例如,下面是我们当前的结构,添加了一个“发布”文件夹。 Would there be an easy way to move a tagged branch to 'release' each time, or even have 'release' be a link to the newest release_* version?是否有一种简单的方法可以将标记的分支每次都移动到“发布”,或者甚至让“发布”成为最新 release_* 版本的链接?

我们的颠覆文件夹结构

Clarification澄清

Here's an example of how our build/release process currently works:以下是我们的构建/发布过程当前如何工作的示例:

  • Today, I release a version of our web app to QA after TeamCity successfully builds it.今天,在 TeamCity 成功构建后,我向 QA 发布了我们的 web 应用程序版本。 When doing so, I branch/tag it这样做时,我分支/标记它
  • Tomorrow onward, devs continue making updates in the trunk.明天开始,开发人员将继续在后备箱中进行更新。 These will not be pushed to QA until the next QA release在下一个 QA 版本之前,这些不会被推送到 QA
  • On Wednesday, our QA team notifies us that they've found a bug.周三,我们的 QA 团队通知我们他们发现了一个错误。 We make a bug fix on the QA branch, merge the change back to the trunk, and push the updated QA branch back to QA.我们对 QA 分支进行了错误修复,将更改合并回主干,并将更新的 QA 分支推送回 QA。 ISSUE #1: TeamCity is no longer working for us since we're in a #'d QA branch问题 #1:TeamCity 不再为我们工作,因为我们在 #'d QA 分支
  • On Friday, QA approves the release for production, so we publish and branch/tag周五,QA 批准了生产版本,因此我们发布并分支/标记
  • On Monday, a client calls with an issue requiring a small change to production.周一,一位客户致电询问需要对生产进行小改动的问题。 We make the change in the release branch and merge back to the trunk.我们在发布分支中进行更改并合并回主干。 ISSUE #2: Once again, we're making a change without TeamCity helping us问题 #2:再一次,我们在没有 TeamCity 帮助的情况下做出改变

I would (and do) take a slightly different approach to this.我会(并且确实)对此采取稍微不同的方法。 Source control management is primarily for, well, managing source and treating it as a means of tracking or implying releases can make life a little tricky.源代码控制管理主要是为了管理源代码并将其视为跟踪或暗示发布的一种手段,这会使生活变得有些棘手。 This is really the purpose of your continuous integration environment and it does a far better job of it than what SVN does.这确实是您的持续集成环境的目的,它比 SVN 做得更好。

I use TeamCity as the means of identifying both path and revision number to pull from SVN.我使用 TeamCity 作为识别从 SVN 中提取的路径和修订号的方法。 It's easy enough to define this at build runtime and any release to production is always done with caution (ie carefully check both path and revision).在构建运行时定义这一点很容易,并且任何发布到生产环境时都要谨慎(即仔细检查路径和修订版)。 In the absolute worst case, if you do screw it up, you can always re-run the build with revised parameters.在绝对最坏的情况下,如果你搞砸了,你总是可以使用修改后的参数重新运行构建。

You really don't want to end up making code changes directly to a "Releases" folder - this is what the trunk is for if it's mainstream development or branches are for if you've had to adjust an earlier revision.你真的不希望直接对“Releases”文件夹进行代码更改——如果它是主流开发,这就是主干的用途,如果你不得不调整早期版本,这就是分支的用途。 It's sort of beating SVN into submission to do something that's not its core strength, On that front, you might find some of the tips in The 10 commandments of good source control management useful.它有点像击败 SVN 以屈服于做一些不是其核心优势的事情,在这方面,您可能会发现良好源代码控制管理的 10 条诫命中的一些技巧很有用。

You can easily script this so that after build completion you can copy a file or contents of a folder into release folder.您可以轻松编写脚本,以便在构建完成后将文件夹的文件或内容复制到发布文件夹中。 You can even delete the contents of the release folder before doing this.您甚至可以在执行此操作之前删除发布文件夹的内容。 So yes, since a branch or tag in svn is a copy operation you can do this easily.所以是的,因为 svn 中的分支或标签是一个复制操作,你可以轻松地做到这一点。

For each project we have a Latest folder that contains, well, the latest version (usually just the binaries).对于每个项目,我们都有一个包含最新版本(通常只是二进制文件)的Latest文件夹。

This is extremely useful for continuous integration although we have to use custom MSBuild scripts to achieve this eg do a Svn delete on the contents then an Svn copy to the Latest folder.这对于持续集成非常有用,尽管我们必须使用自定义 MSBuild 脚本来实现这一点,例如对内容执行 Svn 删除,然后将 Svn 复制到最新文件夹。

You can use the svn:external property to have a folder called release point to a different tag.您可以使用svn:external属性将名为 release 的文件夹指向不同的标签。 See svn:external .请参阅svn:external

svn propset svn:externals 'release http://my_repo/tags/latest_tag' .

You would have to update the property value to point to the latest tag each time a new tag release was made.每次发布新标签时,您都必须更新属性值以指向最新标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM