代码改变世界

gerrit的使用以及问题总结_gerrit权限和配置

2019-12-21 10:47  加个小鸡腿  阅读(6400)  评论(0编辑  收藏  举报

来自其他博客的汇总,比较重要的部分已经截图出来

 

 参考:https://www.cnblogs.com/yinzhengjie/p/11043239.html

1. Global Capabilities 管理员的权限一般不需要动

2. refs/* 这里对用户Projects List 进行管理,如果用户对一个项目没有该权限的读取功能,则用户不能查询到该项目,即使有该项目的URL也不能从远程拉取该项目。

3. refs/for/*和refs/for/refs/*,用来控制向gerrit仓库push权限。如果需要限制用户push功能,可以将用户组添加至PUSH下选择BLOCK。

4. 指定分支管理,如果不希望用户将代码提交到某一分支(master),可以新加一个reference权限,名叫refs/for/refs/heads/develop,然后设置push权限添加对应用户组,设置权限为BLOCK。

5. 提交新分支,要直接push,因为向gerrit上提交新分支会提示未找到分支。这里要设置的权限是refs/heads/*下面的create reference。添加组并赋予ALLOW即可。

6. 删除远程分支,设置权限refs/heads/*下面的push权限,并且勾选后面的Force Push。

7. refs/heads/*下的Label Code-Review是review代码时评分,有+2评分权限的用户可以让提交的代码通过审核。

详细权限描述:https://www.jianshu.com/p/d95faa9f8b05

看到了一篇很好的博客,大纲如下:

 

 

链接如下:

https://www.ieclipse.cn/2016/05/14/other/tech-gerrit-guide/index.html

Gerrit Code Review ---Project Configuration

      参考: http://gerrit-documentation.storage.googleapis.com/Documentation/2.11/project-configuration.html

另外一篇: 代码检视工具gerrit的日常使用   https://www.jianshu.com/p/b77fd16894b6

还有gerrit review命令行的使用: https://review.opendev.org/Documentation/cmd-review.html

 

问题:gerrit 不经代码审核直接push进库的方法

参考:https://blog.csdn.net/liuxu0703/article/details/54343626

 比如:gerrit配置如下(允许开发者pbb可以强制合入):

 提交:git push origin HEAD:refs/for/master%submit

 

问题:gerrit设置给指定分支指定组代码审核+2的权限

Reference:refs/heads/develop_test

Lable Code-Review -2 +2

Submit:ALLOW

其中:Lable Code-Review是代码审核的权限(-2到+2),Submit是提交入库的submit按钮,不配置的话,不能submit

 参考:

https://blog.csdn.net/hanmengaidudu/article/details/74572670

 

问题:gerrit设置默认rebase以及禁用分支

1.设置默认rebase

在工程配置中设置:Projects搜索到工程--》General --》submit type是 “Rebase if Necessary”

 2.禁用分支

Refrance:refs/for/refs/heads/分支名

push  “Block”   Administrators   勾选Exclusive  【这样就禁止了开发者往这个分支上提交代码】

 

问题: