Project

General

Profile

Gerrit » History » Version 10

laforge, 05/28/2016 12:02 PM
add some rationale as well as further information

1 1 zecke
h1. Contributing using Gerrit
2 1 zecke
3 10 laforge
At [[OpenBSC:OsmoDevCon2016]] we discussed problems with our past contribution / patch submission process using mails on the mailing list as well as patchwork.  The result is that we want to give Gerrit a try for some time and see if it helps us to have a better process
4 1 zecke
5 10 laforge
Gerrit is a review tool that integrates nicely with git and ssh. You can find general information about Gerrit at https://www.gerritcodereview.com/
6 1 zecke
7 10 laforge
The advantages of Gerrit are:
8 10 laforge
* patch submission status is automatically tracked, also with several revisions for a patch set.
9 10 laforge
* patches are build-tested (and possibly even further tested) by jenkins before they are applied
10 10 laforge
* developers + maintainers can formally vote on a patch (developer: -1/0/+1, maintainer: -2/0/+2)
11 10 laforge
* once a patch has +2 score, it can be (automatically) merged into master
12 10 laforge
* patch sumissions not via git send-email but direcly from git
13 10 laforge
14 10 laforge
h2. Osmocom Subprojects using Gerrit
15 10 laforge
16 1 zecke
The following projects use Gerrit to contribute changes:
17 1 zecke
18 1 zecke
* libosmocore.git
19 1 zecke
* libosmo-abis.git
20 1 zecke
* libosmo-netif.git
21 1 zecke
* libosmo-sccp.git
22 1 zecke
* libsmpp34.git
23 1 zecke
* openbsc.git
24 1 zecke
* osmo-bts.git
25 1 zecke
* osmo-iuh.git
26 1 zecke
* osmo-pcu.git
27 5 zecke
* cellmgr-ng.git
28 1 zecke
* osmo-sip-connector.git
29 1 zecke
 
30 1 zecke
h2. Configuring Gerrit/Account
31 1 zecke
32 10 laforge
You will need to sign-up at https://gerrit.osmocom.org/login/. If you have an Osmocom Redmine account you can use https://osmocom.org/openid as OpenID provider. If you have no Osmocom redmine account, you can simply create one online at the "Register" link in the upper right corner.
33 10 laforge
34 10 laforge
Even without an existing or new redmine account, you should also be able to use any other OpenID provider to authenticate against gerrit (untested).
35 10 laforge
36 10 laforge
After the initial sign-up you will need to:
37 1 zecke
38 1 zecke
* Pick a username (can not be changed)
39 1 zecke
* Add your public ssh key(s)
40 1 zecke
* Add email addresses you intend to use as author/comitter
41 1 zecke
42 1 zecke
h2. Setting up Gerrit for commits and pushing
43 1 zecke
44 2 zecke
* Add the remote to be able to fetch and push to gerrit
45 2 zecke
* Fetch the commit hook that adds Change-Id to each commit to uniquely identify a commit
46 2 zecke
47 2 zecke
<pre>
48 7 neels
USERNAME=gerrit_user_name
49 7 neels
PROJECT=$(basename $PWD)
50 7 neels
git remote add gerrit ssh://$USERNAME@gerrit.osmocom.org:29418/$PROJECT.git
51 7 neels
scp -P 29418 $USERNAME@gerrit.osmocom.org:hooks/commit-msg .git/hooks/
52 7 neels
</pre>
53 7 neels
54 7 neels
* In case your local username matches the gerrit username, the setup shortens to
55 7 neels
56 7 neels
<pre>
57 7 neels
PROJECT=$(basename $PWD)
58 7 neels
git remote add gerrit ssh://gerrit.osmocom.org:29418/$PROJECT.git
59 7 neels
scp -P 29418 gerrit.osmocom.org:hooks/commit-msg .git/hooks/
60 7 neels
</pre>
61 7 neels
62 7 neels
Then
63 7 neels
64 7 neels
* Push for review
65 7 neels
<pre>
66 7 neels
git push gerrit HEAD:refs/for/master
67 7 neels
</pre>
68 7 neels
69 7 neels
* Push a user branch
70 7 neels
<pre>
71 9 neels
git push gerrit HEAD:refs/heads/users/$USERNAME/topic
72 7 neels
</pre>
73 7 neels
74 7 neels
* Directly push to master if you are allowed to
75 7 neels
<pre>
76 7 neels
git push gerrit HEAD:refs/heads/master
77 7 neels
</pre>
78 7 neels
79 7 neels
* List changesets in gerrit
80 7 neels
<pre>
81 7 neels
git ls-remote gerrit changes/*
82 2 zecke
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)