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