Gerrit 代碼審覈服務器

gerrit 部署安裝http://www.cnblogs.com/kevingrace/p/5624122.html html

gerrit 權限管理http://zengestudy.blog.51cto.com/1702365/1772019 git

gerrit 項目權限管理http://www.360doc.com/content/16/0823/13/10058718_585326041.shtml github

                              http://www.360doc.com/content/16/0825/10/10058718_585779620.shtml服務器

Gerrit 對接github http://www.javashuo.com/article/p-txitxgah-ex.html ide

gerrit 代碼同步到github http://www.javashuo.com/article/p-kgpcwsoy-r.html url

精華部分:more gerrit_site/etc/replication.configspa

 [remote "10.0.3.254"]code

   url = git@10.0.3.254:auto/${name}.git    #在 gerrit 文檔中有一個 ${name} 變量用來複制 Gerrit 的全部項目orm

   push = +refs/heads/*:refs/heads/*htm

   push = +refs/tags/*:refs/tags/*

   push = +refs/changes/*:refs/changes/*

   threads = 3

gerrit 分支操做記錄 https://www.cnblogs.com/kevingrace/p/5688724.html    


refs/for 和 refs/heads

向gerrit服務器提交代碼命令: 

$git push origin HEAD:refs/for/mybranch

refs/for/mybranch須要通過code review以後才能夠提交;

refs/heads/mybranch不須要code review。


master分支

項目的master分支默認只有administrators和Project Owners能夠不經代碼審覈直接推送,可是容許其餘用戶向master分支推送changes接受評審。這裏調整爲Registered Users組用戶不能向master推送changes,而只能向devel分支推送changes。devel分支的權限默認便可。項目只有兩個常設分支master和devel,平常開發只在devel分支上,只有管理員才能touch master分支。

Project->list(選定項目)->Access->Edit->Add Reference

reference的名字爲:refs/for/refs/heads/master,而後添加push權限,添加組」Registered Users」,選擇對應的push權限爲deny,同時勾選Exclusive,覆蓋掉該ref繼承和被通配符所涵蓋的權限。

Code Review和submit

gerrit默認只給Registered Users組用戶Code View -1分到1分的權限,這樣Registered Users組用戶就沒法獨立完成代碼審覈,而developer都集中在這個組中,所以將其Code View權限調整爲-2分到2分。並且改組用戶沒有submit的權限,沒法合併補丁到倉庫中,下面一併添加submit權限。

Project->list(選定項目)->Access->Edit->Add Reference

reference的名字爲:refs/heads/*,而後添加Label Code-Review,添加組」Registered Users」,將其權限調整爲-2 ~ 2。而後再添加Submit權限,添加組」Registered Users」,其權限爲ALLOW。

sandbox分支

我的分支仍是十分有必要的,在開發成果尚未達到能夠參加評審以前,用戶能夠在我的分支暫存本身的代碼。stash暫存區並不能替代我的分支。Gerrit也考慮到了這一點,能夠經過配置爲每一個開發者提供一個獨立的區域,能夠不用參與代碼評審,徹底是我的私有的領域。

添加以下引用:
refs/heads/sandbox/${username}/*
而後選擇權限Create Reference和push,讓」Registered Users」組對應的權限皆爲ALLOW就能夠了。

調整後的權限

gerrit privillege         

相關文章
相關標籤/搜索