简体   繁体   English

使用git分支进行持续集成

[英]Continuous integration using git branches

For every story we use a branch in Git. 对于每个故事,我们在Git中使用一个分支。 This works great locally but poses a problem when finalizing a feature as we (currently) only push master to our Test environment (IIS). 这在本地效果很好,但是在完成功能时提出了一个问题,因为我们(当前)仅将master推送到我们的测试环境(IIS)。 Note that we are using Git next to TFS as TFS is still our main VCS. 请注意,我们在TFS旁边使用Git,因为TFS仍然是我们的主要VCS。

We are using TeamCity to build all our branches. 我们正在使用TeamCity建立我们的所有分支。 How do you test and review code on a test machine while not polluting the main branch? 您如何在不污染主分支的情况下在测试机上测试和查看代码? Create multiple IIS applications for every branch? 为每个分支创建多个IIS应用程序? This could be automated but seems contrived. 这可以是自动化的,但似乎是人为的。

To clarify, we need to be able to simultaneously test different versions on our test environment. 为了澄清,我们需要能够在我们的测试环境中同时测试不同的版本。

To summarize, I've created several applications in IIS, one for every dev in the team (dev & test) and then 3 slots for test purposes alone. 总而言之,我已经在IIS中创建了多个应用程序,一个用于团队中的每个开发人员(开发和测试),然后一个用于测试目的的3个插槽。

In teamcity we have the build run every against every branch, but do not deploy automatically anymore. 在teamcity中,我们针对每个分支运行构建,但是不再自动部署。 The reasoning is that we allow pulls of our builds but don't force upgrades. 原因是我们允许拉动构建,但不强制升级。

When all dev work on a feature branch is complete we merge into master and then sync immediately with TFS so that our master branch is in sync. 在功能分支上完成所有开发工作后,我们将合并到master中,然后立即与TFS同步,以便我们的master分支处于同步状态。 This allows us to merge each feature per changeset into the next stage. 这使我们可以将每个变更集的每个功能合并到下一阶段。

I think you are looking for --dry-run switch: 我认为您正在寻找--dry-run开关:

-n, --dry-run -n,-干运行
Do everything except actually send the updates. 除了实际发送更新外,执行所有其他操作。

git push --dry-run ...

Please note that having multiple test version of the same application can be really confusing!! 请注意,同一应用程序具有多个测试版本可能会造成混淆!

You can adopt something like the GitHub Flow : 您可以采用类似GitHub Flow的方法

  • One branch per feature 每个功能一个分支
  • When the feature is done you deploy it to the test environment 功能完成后,将其部署到测试环境
  • If everything is OK you can merge the feature to master 如果一切正常,您可以将功能合并到母版

In case this is not a viable solution for you, the only alternative I see is to deploy multiple IIS applications. 如果这对您来说不是可行的解决方案,那么我看到的唯一选择是部署多个IIS应用程序。 This can be done relatively easily using a tool like WebDeploy , but you have to think about a "clean-up policy" to remove obsolete web applications. 使用WebDeploy之类的工具可以相对轻松地完成此操作,但是您必须考虑“清除策略”以删除过时的Web应用程序。

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

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