git Gerrit - Gitlab 集成

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23216747/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:58:37  来源:igfitidea点击:

Gerrit - Gitlab Integration

gitgitlabgerrit

提问by dasrohith

In order to improve the development process, our organization have decided to introduce Gerrit in the development workflow. I am the person responsible for implementing Gerrit server. The user guides available in internet were very helpful in implementing Gerrit to our existing workflow. We are using Jenkins and Sonar as Non-interactive users for verifying the builds. But while dealing with repositories one question rises. Most of the open sources are using gerrit-replication plugin to replicate the latest code to their public code repository. These public repositories are exposed using GitLab so that the users can clone the code. Here we doesn't need a public repository as the code is maintained in house.

为了改进开发过程,我们组织决定在开发工作流程中引入 Gerrit。我是负责实施 Gerrit 服务器的人。互联网上提供的用户指南对在我们现有的工作流程中实施 Gerrit 非常有帮助。我们使用 Jenkins 和 Sonar 作为非交互式用户来验证构建。但是在处理存储库时会出现一个问题。大多数开源都使用 gerrit-replication 插件将最新代码复制到他们的公共代码存储库。这些公共存储库使用 GitLab 公开,以便用户可以克隆代码。这里我们不需要公共存储库,因为代码是在内部维护的。

Is it a good choice to point both GitLab and Gerrit to a common git repository location?

将 GitLab 和 Gerrit 都指向一个公共的 git 存储库位置是否是一个不错的选择?

Any help appreciated.

任何帮助表示赞赏。

回答by volker

You can use gerrit in front of gitlab via the replication feature. The replication feature does not do a git clone/fetch, it only pushs (approved) changes to a remote repository.

您可以通过复制功能在 gitlab 前面使用 gerrit。复制功能不会执行 git clone/fetch,它只会将(已批准的)更改推送到远程存储库。

  • you have to import repositories via e.g. 'git push origin master' which requires extra permissions (or you need to be the admin). That is not a big deal unless you forget to remove these permissions. If you forget to remove these permissions or are administrator (who has these permissions): a default "git push" will make it through without being reviewed.
  • you have to make sure that no one can commit to the gitlab instance. Else you have a high chance to run into merge conflicts (gerrit is not aware of these new commits). You can protect the branches in gitlab -- but the admins (and if I remember correct also the repository creator/owner) will always have this right, too.
  • You have to grant a gerrit user master permissions to allow it push to the gitlab repository.
  • All projects have to be first created in gitlab, else they will not be synchronized (unless you find a way that the repo will be automatically created in gitlab on the first git push)
  • 您必须通过例如“git push origin master”导入存储库,这需要额外的权限(或者您需要成为管理员)。除非您忘记删除这些权限,否则这没什么大不了的。如果您忘记删除这些权限或者是管理员(拥有这些权限):默认的“git push”将通过而不被。
  • 你必须确保没有人可以提交 gitlab 实例。否则你很有可能遇到合并冲突(gerrit 不知道这些新提交)。您可以保护 gitlab 中的分支——但是管理员(如果我没记错的话,还有存储库创建者/所有者)也将始终拥有此权利。
  • 您必须授予 gerrit 用户主权限才能将其推送到 gitlab 存储库。
  • 所有项目必须先在 gitlab 中创建,否则它们将不会被同步(除非你找到一种方法,在第一次 git push 时会在 gitlab 中自动创建 repo)