如何在git的多个部署环境中保持更改分离和隔离? [英] How do you keep changes separate and isolated across multiple deployment environments in git?

查看:208
本文介绍了如何在git的多个部署环境中保持更改分离和隔离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的工作场所,我们正在尝试设计一个基于Git的工作流来处理我们的部署和对代码的更改。



我们有一个Java EE Web应用程序3部署环境(测试,质量保证和生产)。我们还有一个Jenkins CI实例来处理构建和部署。



当对应用程序的代码(分支机构)进行更改时,我们需要能够选择和选择哪些提升到质量保证和生产。有些人可能会获得质量保证,然后再不会进行生产。



在宣传和合并时,我们还需要不小心将其他人的代码免于分支。 >

分支机构的促销也需要自动化 - 以这样的方式,分析人员将选择分支机构或变更集,然后詹金斯或其他一些脚本将进行实际的合并和部署。我在这里看到合并冲突是一个问题...



您如何建议(a)Git存储库来处理这些要求?

解决方案

正如我在 Git代码升级 / a>,不要忘记,分支机构不是,只能隔离开发工作(例如环境促销)。



你还有git仓库本身,您可以为特定角色(测试回购,QA回购等)分配一个git repo。



结合 Gitolite ,您可以保护这些存储库免受不应该访问的用户的访问直接推动到开发生命周期的某个阶段。



还结合 guarded commit ,你可以推送一个测试回购,这将是:




  • 如果不通过编辑和/或某些单元测试

  • 或接受它,并自动推送它,请拒绝您的提交到质量检查报告进行审查。


At my workplace, we are attempting to design a workflow based around Git to handle our deployments and changes to the code.

We have a Java EE web application and 3 deployment environments (Test, QA and Production). We also have an instance of Jenkins CI to handle builds and deployments.

When changes are made to the application's code (in branches) we need to be able to pick and choose which ones get promoted to QA and Production. Some might get to QA and then never go to production.

We also need to be immune to accidentally including everyone else's code in your branch when promoting and merging.

The "promotion" of branches needs to also be automated - in such a way that an analyst would select the branch or changeset and then jenkins or some other script would do the actual merging and deployment. I see merge conflicts being an issue here...

How would you recommend setting up (a) Git repository(ies) to handle these requirements?

解决方案

As I mention in "Code Promotion with Git", don't forget that branches are not your only way to isolate development effort (like promotion across environment).

You have also git repositories themselves, and you can assign a git repo to a specific role (the "Test" repo, the "QA "repo", and so on)

Combined with Gitolite, you can protect those repositories against access by users who shouldn't directly push to a certain stage in development life-cycle.

Also combined with guarded commit, you can push to a test repo which would:

  • reject your commit if it doesn't pass compilation and / or certain unit tests
  • or accept it, and push it automatically to a QA repo for review.

这篇关于如何在git的多个部署环境中保持更改分离和隔离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆