您的位置:首页 > 其它

Gerrit 系统初探

2013-11-22 13:50 375 查看

Gerrit使用简介

Gerrit,一种免费、开放源代码的代码审查软件,使用网页界面。利用网页浏览器,同一个团队的软件程序员,可以相互审阅彼此修改后的程序代码,决定是否能够提交,退回或者继续修改。它使用Git作为底层版本控制系统。(from百度百科)

Gerrit审核系统搭建过程

创建gerrit2用户

$sudouseradd-m-d/home/gerrit2-s/bin/bashgerrit2

$sudosugerrit2

安装mysql以及java环境

略。apt-get

配置mysql

#mysql-uroot–p

Mysql>

#CREATEUSER'gerrit2'@'localhost'IDENTIFIEDBY'secret';

#CREATEDATABASEreviewdb;

#ALTERDATABASEreviewdbcharset=latin1;

#GRANTALLONreviewdb.*TO'gerrit2'@'localhost';

#FLUSHPRIVILEGES;

下载gerrit并进行初始化

$wgethttp://gerrit-releases.storage.googleapis.com/gerrit-2.7.war

$java-jargerrit-2.7.warinit-dreview_site

参见http://www.infoq.com/cn/articles/Gerrit-jenkins-hudson/

Create'/home/gerrit2/review_site'[Y/n]?Y

LocationofGitrepositories[git]:

Databaseserver
type[h2]:mysql

GerritCodeReviewisnotshippedwithMySQLConnector/J5.1.21

**Thislibraryisrequiredforyourconfiguration.**

Downloadandinstallitnow[Y/n]?Y

Downloadinghttp://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar
Checksummysql-connector-java-5.1.21.jarOK

Serverhostname
[localhost]:

Server
port
[(mysqldefault)]:

Database
name
[reviewdb]:

Database
username
[gerrit2]:

gerrit2's
password
:secret

confirmpassword:

SMTPserverhostname
[localhost]:

SMTPserver
port
[(default)]:

SMTP
encryption
[NONE/?]:

SMTP
username
:

更具体是进行初始化

运行gerrit审核系统

$./review_site/bin/gerrit.shstart

登录gerrit审核系统官网

默认端口号:8080

修改gerrit界面颜色

默认情况下是纯白色的,不美观可以对
review_site/etc/gerrit.config修改,然后重启服务,下面是一个颜色配置模板:

[theme]

backgroundColor=FCFEEF

textColor=000000

trimColor=D4E9A9

selectionColor=FFFFCC

topMenuColor=D4E9A9

changeTableOutdatedColor=F08080

[theme
"signed-in"]

backgroundColor=FCFEEF

textColor=000000

trimColor=D4E9A9

selectionColor=FFFFCC

topMenuColor=D4E9A9

changeTableOutdatedColor=F08080

更多信息,索引https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#_a_id_theme_a_section_theme

Gerrit系统正常测试

ssh-p29418username@webhost测试gerrit是否正常运行,根据http://www.infoq.com/cn/articles/Gerrit-jenkins-hudson/修改相关ssh配置,成功后会显示如下信息:


****WelcometoGerritCodeReview****


Hidemo,youhavesuccessfullyconnectedoverSSH.


Unfortunately,interactiveshellsaredisabled.

TocloneahostedGitrepository,use:


gitclonessh://demo@localhost:29418/REPOSITORY_NAME.git


Connectiontolocalhostclosed.


Gerrit创建第一个项目

创建项目,克隆病推送代码!

ssh-p29418admin@localhostgerritcreate-project--nameexample.git

注意:在gerrit系统上第一个注册的人自动成为管理员,只有管理员才有创建project权限

Github+gerrit+Jenkins(hudson)+redmine

职责:

GitHubisaresourceformanagingGitcoderepositoriesandinteractingwithotherdevelopers.JenkinsisusedtocontinuouslytestallofthecomponentsofOpenStacktoensurefunctionalityandtoverifythateachchangetothecodebaseworksasintended.GerritisacodereviewsystemoriginallydevelopedforusebytheAndroidOpenSourceProjectandallowsustobuildaworkflowwhereeverychangeispeer-reviewedandtestedbyJenkinsbeforebeingmergedintothemainrepository.

工作流:

developerchecksoutsourcefromgithub.

developermakeschanges.

developerpushestogerrit.

gerritsendschangenoticetojenkinsforintegrationtest.

jenkinspullschangesdirectlyfromgerritgitserver.

onpass,jenkinsadds+1togerritreview,passesreviewtootherdevelopers.

onfailure,jenkinsadds-1togerritreview

pass/failstatuspushedtoredmine

otherdevelopersreviewchange,approve(+2)

gerritcommitschangestogithubrepository.

githubhooknotifiesredmineofupdates.

redminepullschangesfromgithub,parsescommitmessagesforticketinformation.

developerfetchschangesfromgithub...backto2.[EDIT]:weswitchedtopullingdirectlyfromgerrit.Githubremainsasamirrorforpullingproductionsources.

安装运行Jenkins

根据https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger配置jenkins以及Gerrit

jenkins+github/article/2415310.html

java-jarjenkins.war--httpPort=$PORT--httpListenAddress=$HTTP_HOST

howtousejenkins:https://wiki.jenkins-ci.org/display/JENKINS/Use+Jenkins

http://fourkitchens.com/blog/2011/09/20/trigger-jenkins-builds-pushing-github

OpenStack审核流程图:

Background

AvailableLinks:

Jenkins学习:/article/4664634.html

Gerrit学习:http://ci.openstack.org/gerrit.html(介绍了OpenStack源代码开发维护更新流程!)

Gerritintroduction:http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/intro-quick.html

Gerritinstallation:http://gerrit.googlecode.com/svn/documentation/2.1.6/install.html

Git、Gerrit与Jenkins/HudsonCI服务器:

http://www.infoq.com/cn/articles/Gerrit-jenkins-hudson/

GerritJenkinsGithub:https://wiki.openstack.org/wiki/GerritJenkinsGithub

IdeasandActions:https://groups.google.com/forum/#!msg/repo-discuss/rersrCtdEiY/usAodLofFo8J

Gerrit工作流:https://wiki.openstack.org/wiki/GerritWorkflow

gitdiff的用法:http://blog.sina.com.cn/s/blog_40e9d4dd0100xi8p.html

gitrebase用法:/article/4776112.html

Gerrit安装:http://ci.openstack.org/gerrit.html

图解GIT:http://nettedfish.sinaapp.com/blog/2013/08/05/deep-into-git-with-diagrams/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: