Gerrit

From Wikitech
Revision as of 13:16, 31 October 2012 by ^demon (Talk | contribs)

Jump to: navigation, search

We use Gerrit for our code review system for Git. It supersedes the CodeReview extension.

Contents

Quick links

Details

Gerrit is installed on manganese in the prefix /var/lib/gerrit2. A slave instance runs on formey for fallover purposes.

It is a Java daemon which listens for HTTP connections (port 8080) and SSH connections (port 29418). Apache on manganese proxies the relevant URLs on port 80 and 443 through to Gerrit. The SSH port provides a restricted shell for Git checkouts and administrative commands.

It uses the misc DB server (db1048), database name "reviewdb", for most storage. Git repos are on NFS and stored at /var/lib/gerrit2/review_site/git.

It uses the LDAP instance shared with subversion and labs, possibly on virt0.wikimedia.org, for authentication. Accounts under ou=people,dc=wikimedia,dc=org and groups under ou=groups,dc=wikimedia,dc=org are exposed to Gerrit. The Gerrit account name is the "cn" field in LDAP. In order to log in to Gerrit, a user needs to already have a Labs account. See "Help:Access" on the Labsconsole wiki for the process of getting a Labs account.

Gerrit shells out to GitWeb, a Perl application which is installed using the stock package.

To find out what version of Gerrit is running, you can use either of the following two commands:

java -jar /var/lib/gerrit2/gerrit.war version
ssh -p 29418 gerrit.wikimedia.org gerrit version

It is 2.4.2-2-ge9a1970 at the time of writing.

Using git

This is documented on the labsconsole wiki and on mediawiki.org.

Upgrading Gerrit

  1. Back up the database (db1048.reviewdb) and git directories (/var/lib/gerrit2/review_site/git/). Just In Case.
  2. Download the latest .war file from Google Code to /var/lib/gerrit2/.
  3. Stop the gerrit daemon (/var/lib/gerrit2/review_site/bin/gerrit.sh stop)
  4. Start gerrit with the new *.war file using the "init" flag. For example: cd /var/lib/gerrit2 && java -jar gerrit-2.3.war init -d review_site
  5. The updater is going to ask you some questions, keep the current values. When it asks you if you want to copy the *.war file to the bin directory, say yes.
  6. Profit!!

Note: You may need to restart gerrit after the upgrade is finished.

Custom package

We maintain our own fork of Gerrit which is hosted ... in Gerrit! You will have to clone gerrit.wikimedia.org/operations/gerrit -b stable-2.4-wmf. The branch is a fork of upstream stable-2.4 with our custom patches piled on top.

To build the war:

mvn package -Dgerrit.include-documentation=1 -Dgwt.style=pretty

To replace the live version:

service gerrit stop
java -jar <custom war> init -d /var/lib/gerrit2/review_site --batch
service gerrit start

Creating new repositories

see mw:Git/Creating new repositories

See also

Personal tools
Namespaces

Variants
Actions
Navigation
Ops documentation
Wiki
Toolbox