分离开发和部署 git 存储库 [英] Separate development and deployment git repositories

查看:17
本文介绍了分离开发和部署 git 存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了一种管理项目及其可交付成果的方法.项目团队正在使用 git 存储库进行开发.还有另一个存储库用于部署工件.我可以看到这种方法的几个好处.

  1. 保持部署历史干净(没有开发人员提交)
  2. 对部署存储库的访问权限有限(由于他们无权访问部署存储库,因此开发人员无法推动掌握和破坏事物)
  3. 所有依赖项都在部署存储库中.这降低了在部署的不同阶段运行 bower install 或类似依赖项管理器并获得不同结果的风险.

您认为这种方法的优缺点是什么?

解决方案

主要好处是保持可交付的工件(可能很大,可能包括二进制文件)与源代码库分离..>

  • 主存储库仍然是纯源存储库(意味着文本内容,没有——或很少——二进制文件)
  • 交付仓库:
    • 独立管理,
    • 不必完全克隆(浅克隆就足够了,因为该功能最近已得到改进)
    • 如有必要,可以进行清理"(修剪现在已经过时的旧交付)

主要的不便(对于这两种方法)是将二进制文件保存在 git 存储库中(这不适合此类工件).
存在替代方案(使用 git):git-annex, bup, ....
或者,您可以将这些可交付成果存储在专用参考中,例如 Nexus(不同于 git repo)

I recently came across an approach of managing a project and its deliverable. Project team was using git repository for development. There was another repository being used for deploying artifacts. I can see several benefits with this approach.

  1. Keep the deployment history clean ( No developer commits )
  2. Limited access to deployment repository ( No developer can push to master and break things as they do not have access to the deployment repository )
  3. All the dependencies are in the deployment repository. This reduces the risk of running bower install or similar dependency managers at different stages of deployment and getting different results.

What are the benefits and disadvantages of this approach in your opinion ?

解决方案

The main benefit is to keep deliverable artifacts (which can be large and can include binaries) separate from the source repo.

  • the main repo remains a source-only repo (meaning text content, no -- or few and small -- binaries)
  • the delivery repo:
    • is managed independently,
    • doesn't have to be cloned completely (a shallow clone can be enough, since that feature has been improved recently)
    • can be "cleanup" if necessary (trimming old deliveries now obsolete)

The main inconvenient (for both approaches) is to keep binaries in a git repo (which isn't a good fit for such artifacts).
Alternatives exist (using git): git-annex, bup, ....
Or you can store those deliverable in a dedicated referential, like Nexus (which is different from a git repo)

这篇关于分离开发和部署 git 存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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