简体   繁体   English

GitFlow:正确测试发行分支和硕士

[英]GitFlow: Properly Testing Release Branches & Master

I have been looking for a good branching model in git and found GitFlow would fit our development environment pretty well. 我一直在git中寻找一个好的分支模型,发现GitFlow非常适合我们的开发环境。 However, one outstanding question is how and where to test our releases. 但是,一个悬而未决的问题是如何以及在何处测试我们的版本。

Release branches sound like a place to run all of the regression tests prior to the release. 发布分支听起来像是在发布之前运行所有回归测试的地方。 However, release branches are then merged into master, tagged, and that is what finally goes out to production. 然而,发布分支然后合并到master,tagged,这就是最终生产的东西。 What happens if there are merging conflicts from release branch to master? 如果从发布分支到主服务器之间存在合并冲突,会发生什么? Sounds like master needs to be completely re-tested (which could be costly). 听起来像主人需要完全重新测试(这可能是昂贵的)。 Even if there are no conflicts, is it safe to simply push that merge to production, or is there a need to run additional basic smoke tests? 即使没有冲突,简单地将合并推送到生产中是否安全,或者是否需要运行额外的基本烟雾测试?

After carefully tracing the GitFlow diagram, I convinced myself that there should never be any conflicts when merging into master (that is if the process is strictly followed). 仔细追查后GitFlow图,我相信自己,融入主站时永远不应该有任何冲突(也就是当这个过程严格遵循)。 The reason, is because of the timeline: 原因是因为时间表:

  1. Develop branch is created from Master 开发分支是由Master创建的
  2. Features are committed on Develop branch 功能在Develop分支上提交
  3. Release branch is created (which includes all the commits from Develop so far) 创建发布分支(包括目前为止所有来自Develop的提交)
  4. Bugs are fixed in Release branch 错误在Release分支中修复
  5. When ready, the Release branch is merged into Master 准备好后,Release分支将合并到Master中
  6. Master must contain all of the commits from Develop + Release branches. Master必须包含Develop + Release分支的所有提交。 Conflicts should not occur because there was nothing done on Master after Develop branch was created (that's the only way conflicts would happen). 冲突不应该发生,因为在创建开发分支之后没有对Master进行任何操作(这是冲突发生的唯一方式)。 In addition, the code at this point should be identical to the latest commit on the Release branch, which is means there is no need for additional testing. 此外,此时的代码应与Release分支上的最新提交相同,这意味着无需进行其他测试。

I simplified the GitFlow diagram to convince myself of this: 我简化了GitFlow图来说服自己:

在此输入图像描述

I think that testing should be done at every stage of release. 我认为应该在发布的每个阶段进行测试。 Create a light subset of release tests that you can run directly against production to at least test the basic functionality. 创建一个轻量级的发布测试,您可以直接针对生产运行,以至少测试基本功能。 Don't load/perf test against production, of course. 当然,不要对生产进行加载/性能测试。

Depending on what your product is, and how you push it out, the actual testing can change. 根据您的产品以及如何推出产品,实际测试可能会发生变化。 We've got a few production servers to which we deploy new release code. 我们有一些生产服务器,我们部署了新的发布代码。 Those servers are tested thoroughly, but are not accessible by our customers. 这些服务器经过彻底测试,但我们的客户无法访问。 When those check out, we swap them out with the rest of our production servers. 当这些签出时,我们将其与其他生产服务器交换出来。 The deployment and testing is repeated. 重复部署和测试。 After everything passes, all production servers are put back into out live pool of customer-facing servers. 一切都过后,所有生产服务器都会重新投入到面向客户的服务器的实时池中。

In case of some failure, we roll back in much the same way. 如果发生某些故障,我们会以同样的方式回滚。

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

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