blob: 6056e573c6d6f14f7dfeb8e0b90ac2b52028c1f5 [file] [log] [blame]
Edwin Kempin4bf01962014-04-16 16:47:10 +02001= Project Owner Guide
2
3This is a Gerrit guide that is dedicated to project owners. It
4explains the many possibilities that Gerrit provides to customize the
5workflows for a project.
6
7[[project-owner]]
8== What is a project owner?
9
10Being project owner means that you own a project in Gerrit.
11Technically this is expressed by having the
12link:access-control.html#category_owner[Owner] access right on
Jonathan Nieder5758f182015-03-30 11:28:55 -070013`+refs/*+` on that project. As project owner you have the permission to
Edwin Kempin4bf01962014-04-16 16:47:10 +020014edit the access control list and the project settings of the project.
15It also means that you should get familiar with these settings so that
16you can adapt them to the needs of your project.
17
18Being project owner means being responsible for the administration of
19a project. This requires having a deeper knowledge of Gerrit than the
20average user. Normally per team there should be 2 to 3 persons, who
21have a certain level of Git/Gerrit knowledge, assigned as project
22owners. It normally doesn't make sense that everyone in a team is
23project owner. For normal team members it is sufficient to be committer
24or contributor.
25
26[[access-rights]]
27== Access Rights
28
29As a project owner you can edit the access control list of your
30project. This allows you to grant permissions on the project to
31different groups.
32
33Gerrit comes with a rich set of permissions which allow a very
34fine-grained control over who can do what on a project. Access
35control is one of the most powerful Gerrit features but it is also a
36rather complex topic. This guide will only highlight the most
37important aspects of access control, but the link:access-control.html[
38Access Control] chapter explains all the details.
39
40[[edit-access-rights]]
41=== Editing Access Rights
42
43To see the access rights of your project
44
David Pursehousea1d633b2014-05-02 17:21:02 +090045- go to the Gerrit Web UI
Edwin Kempin4bf01962014-04-16 16:47:10 +020046- click on the `Projects` > `List` menu entry
47- find your project in the project list and click on it
48- click on the `Access` menu entry
49
50By clicking on the `Edit` button the access rights become editable and
51you may save any changes by clicking on the `Save Changes` button.
52Optionally you can provide a `Commit Message` to explain the reasons
53for changing the access rights.
54
55The access rights are stored in the project's Git repository in a
56special branch called `refs/meta/config`. On this branch there is a
57`project.config` file which contains the access rights. More
58information about this storage format can be found in the
59link:config-project-config.html[Project Configuration File Format]
60chapter. What is important to know is that by looking at the history
61of the `project.config` file on the `refs/meta/config` branch you can
62always see how the access rights were changed and by whom. If a good
63commit message is provided you can also see from the history why the
64access rights were modified.
65
Dave Borowitza3d67882015-06-05 15:22:23 -070066If a Git browser such as gitweb is configured for the Gerrit server you
Edwin Kempin4bf01962014-04-16 16:47:10 +020067can find a link to the history of the `project.config` file in the
David Pursehousea1d633b2014-05-02 17:21:02 +090068Web UI. Otherwise you may inspect the history locally. If you have
Edwin Kempin4bf01962014-04-16 16:47:10 +020069cloned the repository you can do this by executing the following
70commands:
71
Michael Ochmannb99feab2016-07-06 14:10:22 +020072----
Edwin Kempin32f314b2016-10-12 20:05:27 +020073 $ git fetch ssh://localhost:29418/project refs/meta/config
74 $ git checkout FETCH_HEAD
Edwin Kempin4bf01962014-04-16 16:47:10 +020075 $ git log project.config
Michael Ochmannb99feab2016-07-06 14:10:22 +020076----
Edwin Kempin4bf01962014-04-16 16:47:10 +020077
78Non project owners may still edit the access rights and propose the
79modifications to the project owners by clicking on the `Save for
80Review` button. This creates a new change with the access rights
81modifications that can be approved by a project owner. The project
82owners are automatically added as reviewer on this change so that they
83get informed about it by email.
84
85[[inheritance]]
86=== Inheritance
87
88Normally when a new project is created in Gerrit it already has some
89access rights which are inherited from the parent projects.
90Projects in Gerrit are organized hierarchically as a tree with the
91`All-Projects' project as root from which all projects inherit. Each
92project can have only a single parent project, multi-inheritance is
93not supported.
94
David Pursehousea1d633b2014-05-02 17:21:02 +090095Looking at the access rights of your project in the Gerrit Web UI, you
Edwin Kempin4bf01962014-04-16 16:47:10 +020096only see the access rights which are defined on that project. To see
97the inherited access rights you must follow the link to the parent
98project under `Rights Inherit From`.
99
100Inherited access rights can be overwritten unless they are defined as
101link:access-control.html#block[BLOCK rule]. BLOCK rules are used to
102limit the possibilities of the project owners on the inheriting
103projects. With this, global policies can be enforced on all projects.
104Please note that Gerrit doesn't prevent you from assigning access
105rights that contradict an inherited BLOCK rule, but these access rights
106will simply have no effect.
107
108If you are responsible for several projects which require the same
109permissions, it makes sense to have a common parent for them and to
110maintain the access rights on that common parent. Changing the parent
111of a project is only allowed for Gerrit administrators. This means you
112need to contact the administrator of your Gerrit server if you want to
113reparent your project. One way to do this is to change the parent
David Pursehousea1d633b2014-05-02 17:21:02 +0900114project in the Web UI, save the modifications for review and get the
Edwin Kempin4bf01962014-04-16 16:47:10 +0200115change approved and merged by a Gerrit administrator.
116
117[[refs]]
118=== References
119
120Access rights in Gerrit are assigned on references (aka refs). Refs in
121Git exist in different namespaces, e.g. all branches normally exist
122under `refs/heads/` and all tags under `refs/tags/`. In addition there
123are a number of link:access-control.html#references_special[special refs]
124and link:access-control.html#references_magic[magic refs].
125
126Access rights can be assigned on a concrete ref, e.g.
127`refs/heads/master` but also on ref patterns and regular expressions
128for ref names.
129
Jonathan Nieder5758f182015-03-30 11:28:55 -0700130A ref pattern ends with `+/*+` and describes a complete ref name
131namespace, e.g. access rights assigned on `+refs/heads/*+` apply to all
Edwin Kempin4bf01962014-04-16 16:47:10 +0200132branches.
133
134Regular expressions must start with `^`, e.g. access rights assigned
Jonathan Nieder5758f182015-03-30 11:28:55 -0700135on `+^refs/heads/rel-.*+` would apply to all `+rel-*+` branches.
Edwin Kempin4bf01962014-04-16 16:47:10 +0200136
137[[groups]]
138=== Groups
139
140Access rights are granted to groups. It is useful to know that Gerrit
141maintains its own groups internally but also supports different external
142group backends.
143
David Pursehousea1d633b2014-05-02 17:21:02 +0900144The Gerrit internal groups can be seen in the Gerrit Web UI by clicking
Edwin Kempin4bf01962014-04-16 16:47:10 +0200145on the `Groups` > `List` menu entry. By clicking on a group you can
146edit the group members (`Members` tab) and the group options
147(`General` tab).
148
149Gerrit internal groups contain users as members, but can also include
150other groups, even external groups.
151
152Every group is owned by an owner group. Only members of the owner
153group can administrate the owned group (assign members, edit the group
154options). A group can own itself; in this case members of the group
155can, for example, add further members to the group. When you create new
156groups for your project to assign access rights to committer or other
157roles, make sure that they are owned by the project owner group.
158
159An important setting on a group is the option
160`Make group visible to all registered users.`, which defines whether
161non-members can see who is member of the group.
162
163New internal Gerrit groups can be created under `Groups` >
164`Create New Group`. This menu is only available if you have the global
165capability link:access-control.html#capability_createGroup[Create Group]
166assigned.
167
168Gerrit also has a set of special
169link:access-control.html#system_groups[system groups] that you might
170find useful.
171
172External groups need to be prefixed when assigning access rights to
173them, e.g. link:access-control.html#ldap_groups[LDAP group names] need
174to be prefixed with `ldap/`.
175
176If the link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/singleusergroup[
177singleusergroup] plugin is installed you can also directly assign
178access rights to users, by prefixing the username with `user/` or the
179user's account ID by `userid/`.
180
181[[common-access-rights]]
182=== Common Access Rights
183
184Different roles in a project, such as developer (committer) or
185contributor, need different access rights. Examples for which access
186rights are typically assigned for which role are described in the
187link:access-control.html#example_roles[Access Control] chapter.
188
189[[code-review]]
190=== Code Review
191
192Gerrit's main functionality is code review, however using code review
193is optional and you may decide to only use Gerrit as a Git server with
194access control. Whether you allow only pushes for review or also
195direct pushes depends on the project's access rights.
196
197To push a commit for review it must be pushed to
198link:access-control.html#refs_for[refs/for/<branch-name>]. This means
199the link:access-control.html#category_push_review[Push] access right
200must be assigned on `refs/for/<branch-name>`.
201
202To allow direct pushes and bypass code review, the
203link:access-control.html#category_push_direct[Push] access right is
204required on `refs/heads/<branch-name>`.
205
206By pushing for review you are not only enabling the review workflow,
Edwin Kempincee50e72014-04-24 09:40:22 +0200207but you can also get link:#continuous-integration[automatic
208verifications from a build server] before changes are merged. In
209addition you can benefit from Gerrit's merge strategies that can
210automatically merge/rebase commits on server side if necessary. You can
211control the merge strategy by configuring the
Stefan Lay08ba4732014-05-05 16:36:12 +0200212link:project-configuration.html#submit_type[submit type] on the project. If you
Edwin Kempincee50e72014-04-24 09:40:22 +0200213bypass code review you always need to merge/rebase manually if the tip
214of the destination branch has moved. Please keep this in mind if you
215choose to not work with code review because you think it's easier to
216avoid the additional complexity of the review workflow; it might
217actually not be easier.
Edwin Kempin4bf01962014-04-16 16:47:10 +0200218
219You may also enable link:user-upload.html#auto_merge[auto-merge on
220push] to benefit from the automatic merge/rebase on server side while
221pushing directly into the repository.
222
Edwin Kempineaff6c12014-04-17 15:23:42 +0200223[[project-options]]
224== Project Options
225
226As project owner you can control several options on your project.
227The different options are described in the
Stefan Lay08ba4732014-05-05 16:36:12 +0200228link:project-configuration.html#project_options[Project Options] section.
Edwin Kempineaff6c12014-04-17 15:23:42 +0200229
230To see the options of your project
231
David Pursehousea1d633b2014-05-02 17:21:02 +0900232- go to the Gerrit Web UI
Edwin Kempineaff6c12014-04-17 15:23:42 +0200233- click on the `Projects` > `List` menu entry
234- find your project in the project list and click on it
235- click on the `General` menu entry
236
237[[submit-type]]
238=== Submit Type
239
240An important decision for a project is the choice of the submit type
Sebastian Schuberth774aac92015-04-16 13:21:04 +0200241and the content merge setting (see the `Allow content merges` option).
Stefan Lay08ba4732014-05-05 16:36:12 +0200242The link:project-configuration.html#submit_type[submit type] is the method
Edwin Kempineaff6c12014-04-17 15:23:42 +0200243Gerrit uses to submit a change to the project. The submit type defines
244what Gerrit should do on submit of a change if the destination branch
245has moved while the change was in review. The
Stefan Lay08ba4732014-05-05 16:36:12 +0200246link:project-configuration.html#content_merge[content merge] setting applies
Edwin Kempineaff6c12014-04-17 15:23:42 +0200247if the same files have been modified concurrently and tells Gerrit
248whether it should attempt a content merge for these files.
249
250When choosing the submit type and the content merge setting one must
251weigh development comfort against the safety of not breaking the
252destination branch.
253
254The most restrictive submit type is
Stefan Lay08ba4732014-05-05 16:36:12 +0200255link:project-configuration.html#fast_forward_only[Fast Forward Only]. Using
Edwin Kempineaff6c12014-04-17 15:23:42 +0200256this submit type means that after submitting one change all other open
257changes for the same destination branch must be rebased manually. This
258is quite burdensome and in practice only feasible for branches with
259very few changes. On the other hand, if changes are verified before
260submit, e.g. automatically by a CI integration, with this submit type,
261you can be sure that the destination branch never gets broken.
262
Stefan Lay08ba4732014-05-05 16:36:12 +0200263Choosing link:project-configuration.html#merge_if_necessary[Merge If Necessary]
Edwin Kempineaff6c12014-04-17 15:23:42 +0200264as submit type makes the life for developers more comfortable,
265especially if content merge is enabled. If this submit strategy is used
266developers only need to rebase manually if the same files have been
267modified concurrently or if the content merge on such a file fails. The
268drawback with this submit type is that there is a risk of breaking
269the destination branch, e.g. if one change moves a class into another
270package and another change imports this class from the old location.
271Experience shows that in practice `Merge If Necessary` with content
272merge enabled works pretty well and breaking the destination branch
273happens rarely. This is why this setting is recommended at least for
274development branches. You likely want to start with
275`Merge If Necessary` with content merge enabled and only switch to a
276more restrictive policy if you are facing issues with the build and
277test stability of the destination branches.
278
Edwin Kempin1781adb2014-04-22 10:02:40 +0200279It is also possible to define the submit type dynamically via
280link:#prolog-submit-type[Prolog]. This way you can use different submit
281types for different branches.
282
Edwin Kempineaff6c12014-04-17 15:23:42 +0200283Please note that there are other submit types available; they are
Stefan Lay08ba4732014-05-05 16:36:12 +0200284described in the link:project-configuration.html#submit_type[Submit Type]
Edwin Kempineaff6c12014-04-17 15:23:42 +0200285section.
286
Edwin Kempin1781adb2014-04-22 10:02:40 +0200287[[labels]]
288== Labels
289
290The code review process includes that reviewers formally express their
291opinion about a change by voting on different link:config-labels.html[
292labels]. By default Gerrit comes with the
293link:config-labels.html#label_Code-Review[Code-Review] label and many
294Gerrit servers have the link:config-labels.html#label_Verified[Verified]
295label configured globally. However projects can also define their own
296link:config-labels.html#label_custom[custom labels] to formalize
297project-specific workflows. For example if a project requires an IP
298approval from a special IP-team, it can define an `IP-Review` label
299and grant permissions to the IP-team to vote on this label.
300
301The behavior of a label can be controlled by its
302link:config-labels.html#label_function[function], e.g. it can be
303configured whether a max positive voting on the label is required for
304submit or if the voting on the label is optional.
305
306By using a custom link:#submit-rules[submit rule] it can be controlled
307per change whether a label is required for submit or not.
308
309A useful feature on labels is the possibility to automatically copy
310scores forward to new patch sets if it was a
311link:config-labels.html#label_copyAllScoresOnTrivialRebase[trivial
312rebase] or if link:config-labels.html#label_copyAllScoresIfNoCodeChange[
313there was no code change] (e.g. only the commit message was edited).
314
315[[submit-rules]]
316== Submit Rules
317
318A link:prolog-cookbook.html#SubmitRule[submit rule] in Gerrit is logic
319that defines when a change is submittable. By default, a change is
320submittable when it gets at least one highest vote on each label and
321has no lowest vote (aka veto vote) on any label.
322
323The submit rules in Gerrit are implemented in link:prolog-cookbook.html[
324Prolog] and projects that need more flexibility can define their own
325submit rules to decide when a change should be submittable. A good
326link:prolog-cookbook.html#NonAuthorCodeReview[example] from the Prolog
327cookbook shows how to allow submit only if a change has a
328`Code-Review+2` vote from a person that is not the change author. This
329way a four-eyes principle for the reviews can be enforced.
330
331A Prolog submit rule has access to link:prolog-change-facts.html[
332information] about the change for which it is testing the
Eryk Szymanski2b93eb02016-11-15 17:56:28 -0800333submittability. Among others the list of the modified files can be
Edwin Kempin1781adb2014-04-22 10:02:40 +0200334accessed, which allows special logic if certain files are touched. For
335example, a common practice is to require a vote on an additional label,
336like `Library-Compliance`, if the dependencies of the project are
337changed.
338
339[[prolog-submit-type]]
340It is also possible to control the link:prolog-cookbook.html#SubmitType[
341submit type] from Prolog. For example this can be used to define a more
342restrictive submit type such as `Fast Forward Only` for stable branches
343while using a more liberal submit type, e.g. `Merge If Necessary` with
344content merge, for development branches. How this can be done can be
345seen from an link:prolog-cookbook.html#SubmitTypePerBranch[example] in
346the Prolog cookbook.
347
348Submit rules are maintained in the link:prolog-cookbook.html#RulesFile[
349rules.pl] file in the `refs/meta/config` branch of the project. How to
350write submit rules is explained in the
351link:prolog-cookbook.html#HowToWriteSubmitRules[Prolog cookbook]. There
352is also good support for link:prolog-cookbook.html#TestingSubmitRules[
353testing submit rules] while developing them.
354
Edwin Kempin693888a2014-04-23 13:50:24 +0200355[[continuous-integration]]
356== Continuous Integration
357
358With Gerrit you can have continuous integration builds not only for
359updates of central branches but also whenever a new change/patch set is
360uploaded for review. This way you get automatic verification of all
361changes *before* they are merged and any build and test issues are
362detected early. To indicate the build and test status the continuous
363integration system normally votes with the
364link:config-labels.html#label_Verified[Verified] label on the change.
365
366There are several solutions for integrating continuous integration
367systems. The most commonly used are:
368
369- link:https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger[
370 Gerrit Trigger] plugin for link:http://jenkins-ci.org/[Jenkins]
371
372- link:http://www.mediawiki.org/wiki/Continuous_integration/Zuul[
373 Zuul] for link:http://jenkins-ci.org/[Jenkins]
374
375For the integration with the continuous integration system you must
376have a service user that is able to access Gerrit. To create a service
377user in Gerrit you can use the link:cmd-create-account.html[create-account]
378SSH command if the link:access-control.html#capability_createAccount[
379Create Account] global capability is granted. If not, you need to ask
380a Gerrit administrator to create the service user.
381
382If the link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/serviceuser[
383serviceuser] plugin is installed you can also create new service users
David Pursehousea1d633b2014-05-02 17:21:02 +0900384in the Gerrit Web UI under `People` > `Create Service User`. For this
Edwin Kempin5d6b9f12014-04-24 14:30:07 +0200385the `Create Service User` global capability must be assigned.
Edwin Kempin693888a2014-04-23 13:50:24 +0200386
387The service user must have link:access-control.html#category_read[read]
388access to your project. In addition, if automatic change verification
389is enabled, the service user must be allowed to vote on the
390link:config-labels.html#label_Verified[Verified] label.
391
392Continuous integration systems usually integrate with Gerrit by
393listening to the Gerrit link:cmd-stream-events.html#events[stream
394events]. For this the service user must have the
395link:access-control.html#capability_streamEvents[Stream Events] global
396capability assigned.
397
Edwin Kempin77167752014-07-16 08:21:06 +0200398[[commit-validation]]
399== Commit Validation
400
401Gerrit provides an
402link:https://gerrit-review.googlesource.com/Documentation/config-validation.html#new-commit-validation[
403extension point to do validation of new commits]. A Gerrit plugin
404implementing this extension point can perform validation checks when
405new commits are pushed to Gerrit. The plugin can either provide a
406message to the client or reject the commit and cause the push to fail.
407
408There are some plugins available that provide commit validation:
409
410- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/uploadvalidator[
411 uploadvalidator]:
412+
413The `uploadvalidator` plugin allows project owners to configure blocked
414file extensions, required footers and a maximum allowed path length.
415
416- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/commit-message-length-validator[
417 commit-message-length-validator]
418+
419The `commit-message-length-validator` core plugin validates that commit
420messages conform to line length limits.
421
Edwin Kempin34f4f882014-04-22 16:13:18 +0200422[[branch-administration]]
423== Branch Administration
424
425As project owner you can administrate the branches of your project in
David Pursehousea1d633b2014-05-02 17:21:02 +0900426the Gerrit Web UI under `Projects` > `List` > <your project> >
Stefan Lay08ba4732014-05-05 16:36:12 +0200427`Branches`. In the Web UI both link:project-configuration.html#branch-creation[
428branch creation] and link:project-configuration.html#branch-deletion[branch
Edwin Kempin34f4f882014-04-22 16:13:18 +0200429deletion] are allowed for project owners without requiring any
430additional access rights.
431
432By setting `HEAD` on the project you can define its
Stefan Lay08ba4732014-05-05 16:36:12 +0200433link:project-configuration.html#default-branch[default branch]. For convenience
Edwin Kempin34f4f882014-04-22 16:13:18 +0200434reasons, when the repository is cloned Git creates a local branch for
435this default branch and checks it out.
436
Edwin Kempinef2b6af2014-04-22 11:04:10 +0200437[[notifications]]
438== Email Notifications
439
440With Gerrit individual users control their own email subscriptions. By
David Pursehousea1d633b2014-05-02 17:21:02 +0900441editing the link:user-notify.html#user[watched projects] in the Web UI
Edwin Kempinef2b6af2014-04-22 11:04:10 +0200442under `Settings` > `Watched Projects` users can decide which events to
443be informed about by email. The change notifications can be filtered by
444link:user-search.html[change search expressions].
445
446This means as a project owner you normally don't need to do anything
447about email notifications, except maybe telling your project team where
448to configure the watches.
449
450Gerrit also supports link:user-notify.html#project[notifications on
451project level] that allow project owners to set up email notifications
452for team mailing lists or groups of users. This configuration is done
453in the `project.config` file in the `refs/meta/config` branch as
454explained in the section about link:user-notify.html#project[project
455level notifications].
456
Edwin Kempin09c49602014-04-22 11:33:00 +0200457[[dashboards]]
458== Dashboards
459
460Gerrit comes with a pre-defined user dashboard that provides a view
461of the changes that are relevant for a user. Users can also define
462their own link:user-dashboards.html[custom dashboards] where the
463dashboard sections can be freely configured. As a project owner you can
464configure such custom dashboards on
465link:user-dashboards.html#project-dashboards[project level]. This way
466you can define a view of the changes that are relevant for your
467project and share this dashboard with all users. The project dashboards
David Pursehousea1d633b2014-05-02 17:21:02 +0900468can be seen in the Web UI under `Projects` > `List` > <your project> >
Edwin Kempin09c49602014-04-22 11:33:00 +0200469`Dashboards`.
470
Edwin Kempin96cdad42014-04-22 13:30:56 +0200471[[issue-tracker-integration]]
472== Issue Tracker Integration
473
474There are several possibilities to integrate issue trackers with
475Gerrit.
476
477- Comment Links
478+
Edwin Kempin8691f5a2014-04-30 09:21:57 +0200479As described in the link:#comment-links[Comment Links] section, comment
Edwin Kempin96cdad42014-04-22 13:30:56 +0200480links can be used to link IDs from commit message footers to issues in
481an issue tracker system.
482
483- Tracking IDs
484+
485Gerrit can be configured to index IDs from commit message footers so
486that the link:user-search.html#tr[tr/bug] search operators can be used
487to query for changes with a certain ID. The
488link:config-gerrit.html#trackingid[configuration of tracking IDs] can
489only be done globally by a Gerrit administrator.
490
491- Issue Tracker System Plugins
492+
493There are Gerrit plugins for a tight integration with
494link:https://gerrit-review.googlesource.com/\#/admin/projects/plugins/its-jira[Jira],
495link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/its-bugzilla[Bugzilla] and
496link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/its-rtc[IBM Rational Team Concert].
497If installed, these plugins can e.g. be used to automatically add links
498to Gerrit changes to the issues in the issue tracker system or to
499automatically close an issue if the corresponding change is merged.
500If installed, project owners may enable/disable the issue tracker
David Pursehousea1d633b2014-05-02 17:21:02 +0900501integration from the Gerrit Web UI under `Projects` > `Lists` >
Edwin Kempin96cdad42014-04-22 13:30:56 +0200502<your project> > `General`.
503
504[[comment-links]]
505== Comment Links
506
507Gerrit can linkify strings in commit messages, summary comments and
508inline comments. A string that matches a defined regular expression is
509then displayed as hyperlink to a configured backend system.
510
511So called comment links can be configured globally by a Gerrit
512administrator, but also per project by the project owner. Comment links
513on project level are defined in the `project.config` file in the
514`refs/meta/config` branch of the project as described in the
515documentation of the link:config-gerrit.html#commentlink[commentlink]
516configuration parameter.
517
518Often comment links are used to link an ID in a commit message footer
519to an issue in an issue tracker system. For example, to link the ID
520from the `Bug` footer to Jira the following configuration can be used:
521
Michael Ochmannb99feab2016-07-06 14:10:22 +0200522----
Edwin Kempin96cdad42014-04-22 13:30:56 +0200523 [commentlink "myjira"]
524 match = ([Bb][Uu][Gg]:\\s+)(\\S+)
525 link = https://myjira/browse/$2
Michael Ochmannb99feab2016-07-06 14:10:22 +0200526----
Edwin Kempin96cdad42014-04-22 13:30:56 +0200527
Edwin Kempin5d803952014-04-24 14:19:42 +0200528[[reviewers]]
529== Reviewers
530
531Normally it is not needed to explicitly assign reviewers to every
532change since the project members either link:user-notify.html#user[
533watch the project] and get notified by email or regularly check the
David Pursehousea1d633b2014-05-02 17:21:02 +0900534list of open changes in the Gerrit Web UI. The project members then
Edwin Kempin5d803952014-04-24 14:19:42 +0200535pick the changes themselves that are interesting to them for review.
536
537If authors of changes want to have a review by a particular person
538(e.g. someone who is known to be expert in the touched code area, or a
539stakeholder for the implemented feature), they can request the review
David Pursehousea1d633b2014-05-02 17:21:02 +0900540by adding this person in the Gerrit Web UI as a reviewer on the change.
Edwin Kempin5d803952014-04-24 14:19:42 +0200541Gerrit will then notify this person by email about the review request.
542
543With the link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/reviewers[
544reviewers] plugin it is possible to configure default reviewers who
545will be automatically added to each change. The default reviewers can
David Pursehousea1d633b2014-05-02 17:21:02 +0900546be configured in the Gerrit Web UI under `Projects` > `List` >
Edwin Kempin5d803952014-04-24 14:19:42 +0200547<your project> > `General` in the `reviewers Plugin` section.
548
549The link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/reviewers-by-blame[
550reviewers-by-blame] plugin can automatically add reviewers to changes
551based on the link:https://www.kernel.org/pub/software/scm/git/docs/git-blame.html[
552git blame] computation on the changed files. This means that the plugin
553will add those users as reviewer that authored most of the lines
554touched by the change, since these users should be familiar with the
555code and can most likely review the change. How many reviewers the
556plugin will add to a change at most can be configured in the Gerrit
David Pursehousea1d633b2014-05-02 17:21:02 +0900557Web UI under `Projects` > `List` > <your project> > `General` in the
Edwin Kempin5d803952014-04-24 14:19:42 +0200558`reviewers-by-blame Plugin` section.
559
Edwin Kempine622b792014-04-23 13:06:57 +0200560[[download-commands]]
561== Download Commands
562
563On the change screen in the `Downloads` drop-down panel Gerrit offers
564commands for downloading the currently viewed patch set.
565
566The download commands are implemented by Gerrit plugins. This means
567that the available download commands depend on the installed Gerrit
568plugins:
569
570- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/download-commands[
571 download-commands] plugin:
572+
573The `download-commands` plugin provides the default download commands
574(`Checkout`, `Cherry Pick`, `Format Patch` and `Pull`).
575+
576Gerrit administrators may configure which of the commands are shown on
577the change screen.
578
579- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/egit[
580 egit] plugin:
581+
582The `egit` plugin provides the change ref as a download command, which is
583needed for downloading a change from within
584link:https://www.eclipse.org/egit/[EGit].
585
586- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/project-download-commands[
587 project-download-commands] plugin:
588+
589The `project-download-commands` plugin enables project owners to
590configure project-specific download commands. For example, a
591project-specific download command may update submodules, trigger a
592build, execute the tests or even do a deployment.
593+
594The project-specific download commands must be configured in the
595`project.config` file in the `refs/meta/config` branch of the project:
596+
Michael Ochmannb99feab2016-07-06 14:10:22 +0200597----
Edwin Kempine622b792014-04-23 13:06:57 +0200598 [plugin "project-download-commands"]
David Ostrovskyfdbfcad2016-11-15 06:35:29 -0800599 Build = git fetch ${url} ${ref} && git checkout FETCH_HEAD && bazel build ${project}
Edwin Kempine622b792014-04-23 13:06:57 +0200600 Update = git fetch ${url} ${ref} && git checkout FETCH_HEAD && git submodule update
Michael Ochmannb99feab2016-07-06 14:10:22 +0200601----
Edwin Kempine622b792014-04-23 13:06:57 +0200602+
603Project-specific download commands that are defined on a parent project
604are inherited by the child projects. A child project can overwrite an
605inherited download command, or remove it by assigning no value to it.
Edwin Kempin96cdad42014-04-22 13:30:56 +0200606
Edwin Kempin37e6d962014-04-24 13:32:36 +0200607[[theme]]
608== Theme
609
610Gerrit supports project-specific themes for customizing the appearance
611of the change screen and the diff screens. It is possible to define an
612HTML header and footer and to adapt Gerrit's CSS. Details about themes
613are explained in the link:config-themes.html[Themes] section.
614
615Project-specific themes can only be installed by Gerrit administrators
616since the theme files must be copied into the Gerrit installation
617folder.
618
Edwin Kempin15199792014-04-23 16:22:05 +0200619[[tool-integration]]
620== Integration with other tools
621
622Gerrit provides many possibilities for the integration with other
623tools:
624
625- Stream Events:
626+
627The link:cmd-stream-events.html[stream-events] SSH command allows to
628listen to Gerrit link:cmd-stream-events.html#events[events]. Other
629tools can use this to react on actions done in Gerrit.
630+
631The link:access-control.html#capability_streamEvents[Stream Events]
632global capability is required for using the `stream-events` command.
633
634- REST API:
635+
636Gerrit provides a rich link:rest-api.html[REST API] that other tools
637can use to query information from Gerrit and and to trigger actions in
638Gerrit.
639
640- Gerrit Plugins:
641+
642The Gerrit functionality can be extended by plugins and there are many
643extension points, e.g. plugins can
644+
645** link:dev-plugins.html#top-menu-extensions[add new menu entries]
646** link:dev-plugins.html#ui_extension[extend existing screens] and
647 link:dev-plugins.html#screen[add new screens]
648** link:config-validation.html[do validation], e.g. of new commits
649** add new REST endpoints and link:dev-plugins.html#ssh[SSH commands]
650
651+
652How to develop a Gerrit plugin is described in the link:dev-plugins.html[
653Plugin Development] section.
654
David Pursehousea61ee502016-09-06 16:27:09 +0900655[[project-lifecycle]]
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200656== Project Lifecycle
657
658[[project-creation]]
659=== Project Creation
660
David Pursehousea1d633b2014-05-02 17:21:02 +0900661New projects can be created in the Gerrit Web UI under `Projects` >
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200662`Create Project`. The `Create Project` menu entry is only available if
663you have the link:access-control.html#capability_createProject[
664Create Project] global capability assigned.
665
666Projects can also be created via REST or SSH as described in the
Stefan Lay08ba4732014-05-05 16:36:12 +0200667link:project-configuration.html#project-creation[Project Setup] section.
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200668
669Creating the project with an initial empty commit is generally
670recommended because some tools have issues with cloning repositories
671that are completely empty. However, if you plan to link:#import-history[
672import an existing history] into the new project, it is better to
673create the project without an initial empty commit.
674
675[[import-history]]
676=== Import Existing History
677
678If you have an existing history you can import it into a Gerrit
679project. To do this you need to have a local Git repository that
680contains this history. If your existing codebase is in another VCS you
681must migrate it to Git first. For Subversion you can use the
682link:http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion[
683git svn] command as described in the
684link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Subversion[
685Subversion migration guide]. An importer for Perforce is available in
686the `contrib` section of the Git source code; how to use
687link:http://git-scm.com/docs/git-p4[git p4] to do the import from
688Perforce is described in the
689link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Perforce[
690Perforce migration guide].
691
692To import an existing history into a Gerrit project you bypass code
693review and push it directly to `refs/heads/<branch>`. For this you must
694have the corresponding link:access-control.html#category_push_direct[
695Push] access right assigned. If the destination branch in the Gerrit
696repository already contains a history (e.g. an initial empty commit),
697you can overwrite it by doing a force push. In this case force push
698must be allowed in the access controls of the project.
699
700Some Gerrit servers may disallow forging committers by blocking the
701link:access-control.html#category_forge_committer[Forge Committer]
702access right globally. In this case you must use the
703link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
704git filter-branch] command to rewrite the committer information for all
705commits (the author information that records who was writing the code
706stays intact; signed tags will lose their signature):
707
Michael Ochmannb99feab2016-07-06 14:10:22 +0200708----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200709 $ git filter-branch --tag-name-filter cat --env-filter 'GIT_COMMITTER_NAME="John Doe"; GIT_COMMITTER_EMAIL="john.doe@example.com";' -- --all
Michael Ochmannb99feab2016-07-06 14:10:22 +0200710----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200711
712If a link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
713limit] is configured on the server you may need to remove large objects
714from the history before you are able to push. To find large objects in
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200715the history of your project you can use the `reposize.sh` script which
716you can download from Gerrit:
717
Michael Ochmannb99feab2016-07-06 14:10:22 +0200718----
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200719 $ curl -Lo reposize.sh http://review.example.com:8080/tools/scripts/reposize.sh
720
721or
722
723 $ scp -p -P 29418 john.doe@review.example.com:scripts/reposize.sh .
Michael Ochmannb99feab2016-07-06 14:10:22 +0200724----
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200725
726You can then use the
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200727link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
728git filter-branch] command to remove the large objects from the history
729of all branches:
730
Michael Ochmannb99feab2016-07-06 14:10:22 +0200731----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200732 $ git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch path/to/large-file.jar' -- --all
Michael Ochmannb99feab2016-07-06 14:10:22 +0200733----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200734
735Since this command rewrites all commits in the repository it's a good
736idea to create a fresh clone from this rewritten repository before
737pushing to Gerrit, this will ensure that the original objects which
738have been rewritten are removed.
739
740[[project-deletion]]
741=== Project Deletion
742
743Gerrit core does not support the deletion of projects.
744
745If the link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/delete-project[
746delete-project] plugin is installed, projects can be deleted from the
David Pursehousea1d633b2014-05-02 17:21:02 +0900747Gerrit Web UI under `Projects` > `List` > <project> > `General` by
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200748clicking on the `Delete` command under `Project Commands`. The `Delete`
Edwin Kempin56bac942014-04-24 14:25:42 +0200749command is only available if you have the `Delete Projects` global
750capability assigned, or if you own the project and you have the
751`Delete Own Projects` global capability assigned. If neither of these
752capabilities is granted, you need to contact a Gerrit administrator to
753request the deletion of your project.
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200754
755Instead of deleting a project you may set the
Stefan Lay08ba4732014-05-05 16:36:12 +0200756link:project-configuration.html#project-state[project state] to `ReadOnly` or
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200757`Hidden`.
758
759[[project-rename]]
760=== Project Rename
761
762Gerrit core does not support the renaming of projects.
763
764As workaround you may
765
766. link:#project-creation[create a new project] with the new name
767. link:#import-history[import the history of the old project]
768. link:#project-deletion[delete the old project]
769
Edwin Kempinec86ca12015-04-17 10:03:30 +0200770Please note that a drawback of this workaround is that the whole review
771history (changes, review comments) is lost.
772
773Alternatively, you can use the
774link:https://gerrit.googlesource.com/plugins/importer/[importer] plugin
775to copy the project _including the review history_, and then
776link:#project-deletion[delete the old project].
777
Edwin Kempin4bf01962014-04-16 16:47:10 +0200778GERRIT
779------
780Part of link:index.html[Gerrit Code Review]
781
782SEARCHBOX
783---------