赞
踩
原文连接:http://www.duozhi.online/2023/10/17/gerrit-%e9%85%8d%e7%bd%ae%e8%87%aa%e5%b7%b1%e6%8f%90%e4%ba%a4%e7%9a%84%e4%bb%a3%e7%a0%81%e8%87%aa%e5%b7%b1%e4%b8%8d%e8%83%bdsubmit/
gerrit安装参考:http://www.duozhi.online/2023/10/12/gerrit%e5%ae%89%e8%a3%85/
gerrit ldap参考:http://www.duozhi.online/2023/10/13/gerrit-ldap%e9%85%8d%e7%bd%ae/
自己提交的代码,必须有另外一个人审核后,自己才能submit
目前测试下来,gerrit3.5版本是不支持的
文档地址:http://你的gerrit IP+端口/Documentation/config-submit-requirements.html#code-review-example
下面的配置可以放在All-projects下的refs/meta/config下,或某个项目的refs/meta/config下
[submit-requirement "Code-Review"]
description = A maximum vote from a non-uploader is required for the \
'Code-Review' label. A minimum vote is blocking.
submittableIf = label:Code-Review=MAX,user=non_uploader AND -label:Code-Review=MIN
canOverrideInChildProjects = true
设置好后,owner 可以给自己的change +2,但是不显示submit按钮
root@lili:~/test# git clone "ssh://zhangsan@192.168.72.135:29418/All-Projects" && scp -p -P 29418 zhangsan@192.168.72.135:hooks/commit-msg "All-Projects/.git/hooks/" Cloning into 'All-Projects'... remote: Counting objects: 13, done remote: Finding sources: 100% (13/13) Receiving objects: 100% (13/13), 3.29 KiB 673.00 KiB/s, done. Resolving deltas: 100% (1/1), done. remote: Total 13 (delta 1), reused 6 (delta 1) Note: switching to 'd1e12447de128a6cba59fbc5130506336aa1d12e'. You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by switching back to a branch. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example: git switch -c <new-branch-name> Or undo this operation with: git switch - Turn off this advice by setting config variable advice.detachedHead to false commit-msg 100% 2272 2.3MB/s 00:00 root@lili:~/test# cd All-Projects/ root@lili:~/test/All-Projects# ls -l total 8 -rw-r--r-- 1 root root 336 Oct 17 13:35 groups -rw-r--r-- 1 root root 2525 Oct 17 13:35 project.config root@lili:~/test/All-Projects# vim project.config 添加如上内容到文件结尾 [submit-requirement "Code-Review"] description = A maximum vote from a non-uploader is required for the \ 'Code-Review' label. A minimum vote is blocking. submittableIf = label:Code-Review=MAX,user=non_uploader AND -label:Code-Review=MIN canOverrideInChildProjects = true root@lili:~/test/All-Projects# git add . root@lili:~/test/All-Projects# git commit -am "wulili submit fix" [detached HEAD 8978be5] wulili submit fix 1 file changed, 6 insertions(+) root@lili:~/test/All-Projects# git push origin HEAD:refs/meta/config Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 547 bytes 273.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1) remote: Processing changes: refs: 1, done To ssh://192.168.72.135:29418/All-Projects d1e1244..8978be5 HEAD -> refs/meta/config
添加审核人lisi
新增reviewer组,添加lisi到该组中
配置reviewer组可+2 ,也可submit
这时,zhangsan也可submit了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。