Project

General

Profile

Gerrit » History » Version 11

laforge, 05/28/2016 12:04 PM

1 1 zecke
h1. Contributing using Gerrit
2 1 zecke
3 11 laforge
{{>toc}}
4 11 laforge
5 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
6 1 zecke
7 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/
8 1 zecke
9 10 laforge
The advantages of Gerrit are:
10 10 laforge
* patch submission status is automatically tracked, also with several revisions for a patch set.
11 10 laforge
* patches are build-tested (and possibly even further tested) by jenkins before they are applied
12 10 laforge
* developers + maintainers can formally vote on a patch (developer: -1/0/+1, maintainer: -2/0/+2)
13 10 laforge
* once a patch has +2 score, it can be (automatically) merged into master
14 10 laforge
* patch sumissions not via git send-email but direcly from git
15 10 laforge
16 10 laforge
h2. Osmocom Subprojects using Gerrit
17 10 laforge
18 1 zecke
The following projects use Gerrit to contribute changes:
19 1 zecke
20 1 zecke
* libosmocore.git
21 1 zecke
* libosmo-abis.git
22 1 zecke
* libosmo-netif.git
23 1 zecke
* libosmo-sccp.git
24 1 zecke
* libsmpp34.git
25 1 zecke
* openbsc.git
26 1 zecke
* osmo-bts.git
27 1 zecke
* osmo-iuh.git
28 1 zecke
* osmo-pcu.git
29 5 zecke
* cellmgr-ng.git
30 1 zecke
* osmo-sip-connector.git
31 1 zecke
 
32 1 zecke
h2. Configuring Gerrit/Account
33 1 zecke
34 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.
35 10 laforge
36 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).
37 10 laforge
38 10 laforge
After the initial sign-up you will need to:
39 1 zecke
40 1 zecke
* Pick a username (can not be changed)
41 1 zecke
* Add your public ssh key(s)
42 1 zecke
* Add email addresses you intend to use as author/comitter
43 1 zecke
44 1 zecke
h2. Setting up Gerrit for commits and pushing
45 1 zecke
46 2 zecke
* Add the remote to be able to fetch and push to gerrit
47 2 zecke
* Fetch the commit hook that adds Change-Id to each commit to uniquely identify a commit
48 2 zecke
49 2 zecke
<pre>
50 7 neels
USERNAME=gerrit_user_name
51 7 neels
PROJECT=$(basename $PWD)
52 7 neels
git remote add gerrit ssh://$USERNAME@gerrit.osmocom.org:29418/$PROJECT.git
53 7 neels
scp -P 29418 $USERNAME@gerrit.osmocom.org:hooks/commit-msg .git/hooks/
54 7 neels
</pre>
55 7 neels
56 7 neels
* In case your local username matches the gerrit username, the setup shortens to
57 7 neels
58 7 neels
<pre>
59 7 neels
PROJECT=$(basename $PWD)
60 7 neels
git remote add gerrit ssh://gerrit.osmocom.org:29418/$PROJECT.git
61 7 neels
scp -P 29418 gerrit.osmocom.org:hooks/commit-msg .git/hooks/
62 7 neels
</pre>
63 7 neels
64 7 neels
Then
65 7 neels
66 7 neels
* Push for review
67 7 neels
<pre>
68 7 neels
git push gerrit HEAD:refs/for/master
69 7 neels
</pre>
70 7 neels
71 7 neels
* Push a user branch
72 7 neels
<pre>
73 9 neels
git push gerrit HEAD:refs/heads/users/$USERNAME/topic
74 7 neels
</pre>
75 7 neels
76 7 neels
* Directly push to master if you are allowed to
77 7 neels
<pre>
78 7 neels
git push gerrit HEAD:refs/heads/master
79 7 neels
</pre>
80 7 neels
81 7 neels
* List changesets in gerrit
82 7 neels
<pre>
83 7 neels
git ls-remote gerrit changes/*
84 2 zecke
</pre>
Add picture from clipboard (Maximum size: 48.8 MB)