blob: 15f27dbdff855d6a2e00573e55df0d00b89fdd51 [file] [log] [blame]
Marian Harbachebeb1542019-12-13 10:42:46 +01001:linkattrs:
Edwin Kempin4bf01962014-04-16 16:47:10 +02002= Project Owner Guide
3
4This is a Gerrit guide that is dedicated to project owners. It
5explains the many possibilities that Gerrit provides to customize the
6workflows for a project.
7
8[[project-owner]]
9== What is a project owner?
10
11Being project owner means that you own a project in Gerrit.
12Technically this is expressed by having the
13link:access-control.html#category_owner[Owner] access right on
Jonathan Nieder5758f182015-03-30 11:28:55 -070014`+refs/*+` on that project. As project owner you have the permission to
Edwin Kempin4bf01962014-04-16 16:47:10 +020015edit the access control list and the project settings of the project.
16It also means that you should get familiar with these settings so that
17you can adapt them to the needs of your project.
18
19Being project owner means being responsible for the administration of
20a project. This requires having a deeper knowledge of Gerrit than the
21average user. Normally per team there should be 2 to 3 persons, who
22have a certain level of Git/Gerrit knowledge, assigned as project
23owners. It normally doesn't make sense that everyone in a team is
24project owner. For normal team members it is sufficient to be committer
25or contributor.
26
27[[access-rights]]
28== Access Rights
29
30As a project owner you can edit the access control list of your
31project. This allows you to grant permissions on the project to
32different groups.
33
34Gerrit comes with a rich set of permissions which allow a very
35fine-grained control over who can do what on a project. Access
36control is one of the most powerful Gerrit features but it is also a
37rather complex topic. This guide will only highlight the most
38important aspects of access control, but the link:access-control.html[
39Access Control] chapter explains all the details.
40
41[[edit-access-rights]]
42=== Editing Access Rights
43
44To see the access rights of your project
45
David Pursehousea1d633b2014-05-02 17:21:02 +090046- go to the Gerrit Web UI
Edwin Kempin99700ff2024-01-19 08:12:03 +000047- click on the `BROWSE` > `Repositories` menu entry
Edwin Kempin4bf01962014-04-16 16:47:10 +020048- find your project in the project list and click on it
49- click on the `Access` menu entry
50
51By clicking on the `Edit` button the access rights become editable and
52you may save any changes by clicking on the `Save Changes` button.
53Optionally you can provide a `Commit Message` to explain the reasons
54for changing the access rights.
55
56The access rights are stored in the project's Git repository in a
57special branch called `refs/meta/config`. On this branch there is a
58`project.config` file which contains the access rights. More
59information about this storage format can be found in the
60link:config-project-config.html[Project Configuration File Format]
61chapter. What is important to know is that by looking at the history
62of the `project.config` file on the `refs/meta/config` branch you can
63always see how the access rights were changed and by whom. If a good
64commit message is provided you can also see from the history why the
65access rights were modified.
66
Dave Borowitza3d67882015-06-05 15:22:23 -070067If a Git browser such as gitweb is configured for the Gerrit server you
Edwin Kempin4bf01962014-04-16 16:47:10 +020068can find a link to the history of the `project.config` file in the
David Pursehousea1d633b2014-05-02 17:21:02 +090069Web UI. Otherwise you may inspect the history locally. If you have
Edwin Kempin4bf01962014-04-16 16:47:10 +020070cloned the repository you can do this by executing the following
71commands:
72
Michael Ochmannb99feab2016-07-06 14:10:22 +020073----
Edwin Kempin32f314b2016-10-12 20:05:27 +020074 $ git fetch ssh://localhost:29418/project refs/meta/config
75 $ git checkout FETCH_HEAD
Edwin Kempin4bf01962014-04-16 16:47:10 +020076 $ git log project.config
Michael Ochmannb99feab2016-07-06 14:10:22 +020077----
Edwin Kempin4bf01962014-04-16 16:47:10 +020078
79Non project owners may still edit the access rights and propose the
80modifications to the project owners by clicking on the `Save for
81Review` button. This creates a new change with the access rights
82modifications that can be approved by a project owner. The project
83owners are automatically added as reviewer on this change so that they
84get informed about it by email.
85
86[[inheritance]]
87=== Inheritance
88
89Normally when a new project is created in Gerrit it already has some
90access rights which are inherited from the parent projects.
91Projects in Gerrit are organized hierarchically as a tree with the
David Shevitz7f9b34d2018-03-19 13:24:57 -070092`All-Projects` project as root from which all projects inherit. Each
Edwin Kempin4bf01962014-04-16 16:47:10 +020093project can have only a single parent project, multi-inheritance is
94not supported.
95
David Pursehousea1d633b2014-05-02 17:21:02 +090096Looking at the access rights of your project in the Gerrit Web UI, you
Edwin Kempin4bf01962014-04-16 16:47:10 +020097only see the access rights which are defined on that project. To see
98the inherited access rights you must follow the link to the parent
99project under `Rights Inherit From`.
100
101Inherited access rights can be overwritten unless they are defined as
102link:access-control.html#block[BLOCK rule]. BLOCK rules are used to
103limit the possibilities of the project owners on the inheriting
104projects. With this, global policies can be enforced on all projects.
105Please note that Gerrit doesn't prevent you from assigning access
106rights that contradict an inherited BLOCK rule, but these access rights
107will simply have no effect.
108
109If you are responsible for several projects which require the same
110permissions, it makes sense to have a common parent for them and to
111maintain the access rights on that common parent. Changing the parent
112of a project is only allowed for Gerrit administrators. This means you
113need to contact the administrator of your Gerrit server if you want to
114reparent your project. One way to do this is to change the parent
David Pursehousea1d633b2014-05-02 17:21:02 +0900115project in the Web UI, save the modifications for review and get the
Edwin Kempin4bf01962014-04-16 16:47:10 +0200116change approved and merged by a Gerrit administrator.
117
118[[refs]]
119=== References
120
121Access rights in Gerrit are assigned on references (aka refs). Refs in
122Git exist in different namespaces, e.g. all branches normally exist
123under `refs/heads/` and all tags under `refs/tags/`. In addition there
124are a number of link:access-control.html#references_special[special refs]
125and link:access-control.html#references_magic[magic refs].
126
Patrick Hiesela9c11a72019-01-16 08:38:19 +0100127Gerrit only supports tags that are reachable by any ref not owned by
James Muir3ed66d62023-07-05 08:51:57 -0400128Gerrit. This includes branches (refs/heads/\*) or custom ref namespaces
Patrick Hiesela9c11a72019-01-16 08:38:19 +0100129(refs/my-company/*). Tagging a change ref is not supported.
130When filtering tags by visibility, Gerrit performs a reachability check
131and will present the user ony with tags that are reachable by any ref
132they can see.
133
Edwin Kempin4bf01962014-04-16 16:47:10 +0200134Access rights can be assigned on a concrete ref, e.g.
135`refs/heads/master` but also on ref patterns and regular expressions
136for ref names.
137
Jonathan Nieder5758f182015-03-30 11:28:55 -0700138A ref pattern ends with `+/*+` and describes a complete ref name
139namespace, e.g. access rights assigned on `+refs/heads/*+` apply to all
Edwin Kempin4bf01962014-04-16 16:47:10 +0200140branches.
141
142Regular expressions must start with `^`, e.g. access rights assigned
Jonathan Nieder5758f182015-03-30 11:28:55 -0700143on `+^refs/heads/rel-.*+` would apply to all `+rel-*+` branches.
Edwin Kempin4bf01962014-04-16 16:47:10 +0200144
145[[groups]]
146=== Groups
147
148Access rights are granted to groups. It is useful to know that Gerrit
149maintains its own groups internally but also supports different external
150group backends.
151
David Pursehousea1d633b2014-05-02 17:21:02 +0900152The Gerrit internal groups can be seen in the Gerrit Web UI by clicking
Edwin Kempin06aeaff2024-01-22 11:32:18 +0000153on the `BROWSE` > `Groups` menu entry. By clicking on a group you can
Edwin Kempin4bf01962014-04-16 16:47:10 +0200154edit the group members (`Members` tab) and the group options
155(`General` tab).
156
157Gerrit internal groups contain users as members, but can also include
158other groups, even external groups.
159
160Every group is owned by an owner group. Only members of the owner
161group can administrate the owned group (assign members, edit the group
162options). A group can own itself; in this case members of the group
163can, for example, add further members to the group. When you create new
164groups for your project to assign access rights to committer or other
165roles, make sure that they are owned by the project owner group.
166
167An important setting on a group is the option
168`Make group visible to all registered users.`, which defines whether
169non-members can see who is member of the group.
170
Edwin Kempin06aeaff2024-01-22 11:32:18 +0000171New internal Gerrit groups can be created under `BROWSE` > `Groups`
172and then clicking on the `CREATE NEW` button in the upper right corner.
173The `CREATE NEW` button is only available if you have the global
Edwin Kempin4bf01962014-04-16 16:47:10 +0200174capability link:access-control.html#capability_createGroup[Create Group]
175assigned.
176
177Gerrit also has a set of special
178link:access-control.html#system_groups[system groups] that you might
179find useful.
180
181External groups need to be prefixed when assigning access rights to
182them, e.g. link:access-control.html#ldap_groups[LDAP group names] need
183to be prefixed with `ldap/`.
184
David Pursehouse122f0782018-09-28 13:45:23 +0900185If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/singleusergroup[
Marian Harbach34253372019-12-10 18:01:31 +0100186singleusergroup,role=external,window=_blank] plugin is installed you can also directly assign
Edwin Kempin4bf01962014-04-16 16:47:10 +0200187access rights to users, by prefixing the username with `user/` or the
188user's account ID by `userid/`.
189
190[[common-access-rights]]
191=== Common Access Rights
192
193Different roles in a project, such as developer (committer) or
194contributor, need different access rights. Examples for which access
195rights are typically assigned for which role are described in the
196link:access-control.html#example_roles[Access Control] chapter.
197
198[[code-review]]
199=== Code Review
200
201Gerrit's main functionality is code review, however using code review
202is optional and you may decide to only use Gerrit as a Git server with
203access control. Whether you allow only pushes for review or also
204direct pushes depends on the project's access rights.
205
206To push a commit for review it must be pushed to
207link:access-control.html#refs_for[refs/for/<branch-name>]. This means
208the link:access-control.html#category_push_review[Push] access right
209must be assigned on `refs/for/<branch-name>`.
210
211To allow direct pushes and bypass code review, the
212link:access-control.html#category_push_direct[Push] access right is
213required on `refs/heads/<branch-name>`.
214
215By pushing for review you are not only enabling the review workflow,
Edwin Kempincee50e72014-04-24 09:40:22 +0200216but you can also get link:#continuous-integration[automatic
217verifications from a build server] before changes are merged. In
218addition you can benefit from Gerrit's merge strategies that can
219automatically merge/rebase commits on server side if necessary. You can
220control the merge strategy by configuring the
Changcheng Xiao21885982019-01-15 18:16:51 +0100221link:config-project-config.html#submit-type[submit type] on the project. If you
Edwin Kempincee50e72014-04-24 09:40:22 +0200222bypass code review you always need to merge/rebase manually if the tip
223of the destination branch has moved. Please keep this in mind if you
224choose to not work with code review because you think it's easier to
225avoid the additional complexity of the review workflow; it might
226actually not be easier.
Edwin Kempin4bf01962014-04-16 16:47:10 +0200227
228You may also enable link:user-upload.html#auto_merge[auto-merge on
229push] to benefit from the automatic merge/rebase on server side while
230pushing directly into the repository.
231
Edwin Kempineaff6c12014-04-17 15:23:42 +0200232[[project-options]]
233== Project Options
234
235As project owner you can control several options on your project.
236The different options are described in the
Stefan Lay08ba4732014-05-05 16:36:12 +0200237link:project-configuration.html#project_options[Project Options] section.
Edwin Kempineaff6c12014-04-17 15:23:42 +0200238
David Shevitz7f9b34d2018-03-19 13:24:57 -0700239To see the options of your project:
Edwin Kempineaff6c12014-04-17 15:23:42 +0200240
David Shevitz7f9b34d2018-03-19 13:24:57 -0700241. Go to the Gerrit Web UI.
Edwin Kempin99700ff2024-01-19 08:12:03 +0000242. Click on the `BROWSE` > `Repositories` menu entry.
David Shevitz7f9b34d2018-03-19 13:24:57 -0700243. Find your project in the project list and click it.
244. Click the `General` menu entry.
Edwin Kempineaff6c12014-04-17 15:23:42 +0200245
246[[submit-type]]
247=== Submit Type
248
249An important decision for a project is the choice of the submit type
Sebastian Schuberth774aac92015-04-16 13:21:04 +0200250and the content merge setting (see the `Allow content merges` option).
Changcheng Xiao21885982019-01-15 18:16:51 +0100251The link:config-project-config.html#submit-type[submit type] is the method
Edwin Kempineaff6c12014-04-17 15:23:42 +0200252Gerrit uses to submit a change to the project. The submit type defines
253what Gerrit should do on submit of a change if the destination branch
254has moved while the change was in review. The
Stefan Lay08ba4732014-05-05 16:36:12 +0200255link:project-configuration.html#content_merge[content merge] setting applies
Edwin Kempineaff6c12014-04-17 15:23:42 +0200256if the same files have been modified concurrently and tells Gerrit
257whether it should attempt a content merge for these files.
258
259When choosing the submit type and the content merge setting one must
260weigh development comfort against the safety of not breaking the
261destination branch.
262
263The most restrictive submit type is
Stefan Lay08ba4732014-05-05 16:36:12 +0200264link:project-configuration.html#fast_forward_only[Fast Forward Only]. Using
Edwin Kempineaff6c12014-04-17 15:23:42 +0200265this submit type means that after submitting one change all other open
266changes for the same destination branch must be rebased manually. This
267is quite burdensome and in practice only feasible for branches with
268very few changes. On the other hand, if changes are verified before
269submit, e.g. automatically by a CI integration, with this submit type,
270you can be sure that the destination branch never gets broken.
271
Stefan Lay08ba4732014-05-05 16:36:12 +0200272Choosing link:project-configuration.html#merge_if_necessary[Merge If Necessary]
Edwin Kempineaff6c12014-04-17 15:23:42 +0200273as submit type makes the life for developers more comfortable,
274especially if content merge is enabled. If this submit strategy is used
275developers only need to rebase manually if the same files have been
276modified concurrently or if the content merge on such a file fails. The
277drawback with this submit type is that there is a risk of breaking
278the destination branch, e.g. if one change moves a class into another
279package and another change imports this class from the old location.
280Experience shows that in practice `Merge If Necessary` with content
281merge enabled works pretty well and breaking the destination branch
282happens rarely. This is why this setting is recommended at least for
283development branches. You likely want to start with
284`Merge If Necessary` with content merge enabled and only switch to a
285more restrictive policy if you are facing issues with the build and
286test stability of the destination branches.
287
Edwin Kempin1781adb2014-04-22 10:02:40 +0200288It is also possible to define the submit type dynamically via
289link:#prolog-submit-type[Prolog]. This way you can use different submit
290types for different branches.
291
Edwin Kempineaff6c12014-04-17 15:23:42 +0200292Please note that there are other submit types available; they are
Changcheng Xiao21885982019-01-15 18:16:51 +0100293described in the link:config-project-config.html#submit-type[Submit Type]
Edwin Kempineaff6c12014-04-17 15:23:42 +0200294section.
295
Edwin Kempin1781adb2014-04-22 10:02:40 +0200296[[labels]]
297== Labels
298
299The code review process includes that reviewers formally express their
300opinion about a change by voting on different link:config-labels.html[
301labels]. By default Gerrit comes with the
302link:config-labels.html#label_Code-Review[Code-Review] label and many
303Gerrit servers have the link:config-labels.html#label_Verified[Verified]
304label configured globally. However projects can also define their own
305link:config-labels.html#label_custom[custom labels] to formalize
306project-specific workflows. For example if a project requires an IP
307approval from a special IP-team, it can define an `IP-Review` label
308and grant permissions to the IP-team to vote on this label.
309
310The behavior of a label can be controlled by its
311link:config-labels.html#label_function[function], e.g. it can be
312configured whether a max positive voting on the label is required for
313submit or if the voting on the label is optional.
314
315By using a custom link:#submit-rules[submit rule] it can be controlled
316per change whether a label is required for submit or not.
317
318A useful feature on labels is the possibility to automatically copy
319scores forward to new patch sets if it was a
Edwin Kempin0ff93072022-04-05 14:25:11 +0200320link:config-labels.html#trivial_rebase[trivial rebase] or if
321link:config-labels.html#no_code_change[there was no code change] (e.g.
322only the commit message was edited).
Edwin Kempin1781adb2014-04-22 10:02:40 +0200323
324[[submit-rules]]
325== Submit Rules
326
327A link:prolog-cookbook.html#SubmitRule[submit rule] in Gerrit is logic
328that defines when a change is submittable. By default, a change is
329submittable when it gets at least one highest vote on each label and
330has no lowest vote (aka veto vote) on any label.
331
332The submit rules in Gerrit are implemented in link:prolog-cookbook.html[
333Prolog] and projects that need more flexibility can define their own
334submit rules to decide when a change should be submittable. A good
335link:prolog-cookbook.html#NonAuthorCodeReview[example] from the Prolog
336cookbook shows how to allow submit only if a change has a
337`Code-Review+2` vote from a person that is not the change author. This
338way a four-eyes principle for the reviews can be enforced.
339
340A Prolog submit rule has access to link:prolog-change-facts.html[
341information] about the change for which it is testing the
Eryk Szymanski2b93eb02016-11-15 17:56:28 -0800342submittability. Among others the list of the modified files can be
Edwin Kempin1781adb2014-04-22 10:02:40 +0200343accessed, which allows special logic if certain files are touched. For
344example, a common practice is to require a vote on an additional label,
345like `Library-Compliance`, if the dependencies of the project are
346changed.
347
348[[prolog-submit-type]]
349It is also possible to control the link:prolog-cookbook.html#SubmitType[
350submit type] from Prolog. For example this can be used to define a more
351restrictive submit type such as `Fast Forward Only` for stable branches
352while using a more liberal submit type, e.g. `Merge If Necessary` with
353content merge, for development branches. How this can be done can be
354seen from an link:prolog-cookbook.html#SubmitTypePerBranch[example] in
355the Prolog cookbook.
356
357Submit rules are maintained in the link:prolog-cookbook.html#RulesFile[
358rules.pl] file in the `refs/meta/config` branch of the project. How to
359write submit rules is explained in the
360link:prolog-cookbook.html#HowToWriteSubmitRules[Prolog cookbook]. There
361is also good support for link:prolog-cookbook.html#TestingSubmitRules[
362testing submit rules] while developing them.
363
Edwin Kempin693888a2014-04-23 13:50:24 +0200364[[continuous-integration]]
365== Continuous Integration
366
367With Gerrit you can have continuous integration builds not only for
368updates of central branches but also whenever a new change/patch set is
369uploaded for review. This way you get automatic verification of all
370changes *before* they are merged and any build and test issues are
371detected early. To indicate the build and test status the continuous
372integration system normally votes with the
373link:config-labels.html#label_Verified[Verified] label on the change.
374
375There are several solutions for integrating continuous integration
376systems. The most commonly used are:
377
Edwin Kempin862b49e2022-07-13 10:48:45 +0200378- link:https://plugins.jenkins.io/gerrit-trigger/[
Marian Harbach34253372019-12-10 18:01:31 +0100379 Gerrit Trigger,role=external,window=_blank] plugin for link:http://jenkins-ci.org/[Jenkins,role=external,window=_blank]
Edwin Kempin693888a2014-04-23 13:50:24 +0200380
381- link:http://www.mediawiki.org/wiki/Continuous_integration/Zuul[
Marian Harbach34253372019-12-10 18:01:31 +0100382 Zuul,role=external,window=_blank] for link:http://jenkins-ci.org/[Jenkins,role=external,window=_blank]
Edwin Kempin693888a2014-04-23 13:50:24 +0200383
384For the integration with the continuous integration system you must
385have a service user that is able to access Gerrit. To create a service
386user in Gerrit you can use the link:cmd-create-account.html[create-account]
387SSH command if the link:access-control.html#capability_createAccount[
388Create Account] global capability is granted. If not, you need to ask
389a Gerrit administrator to create the service user.
390
David Pursehouse122f0782018-09-28 13:45:23 +0900391If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/serviceuser[
Marian Harbach34253372019-12-10 18:01:31 +0100392serviceuser,role=external,window=_blank] plugin is installed you can also create new service users
David Pursehousea1d633b2014-05-02 17:21:02 +0900393in the Gerrit Web UI under `People` > `Create Service User`. For this
Edwin Kempin5d6b9f12014-04-24 14:30:07 +0200394the `Create Service User` global capability must be assigned.
Edwin Kempin693888a2014-04-23 13:50:24 +0200395
396The service user must have link:access-control.html#category_read[read]
397access to your project. In addition, if automatic change verification
398is enabled, the service user must be allowed to vote on the
399link:config-labels.html#label_Verified[Verified] label.
400
401Continuous integration systems usually integrate with Gerrit by
402listening to the Gerrit link:cmd-stream-events.html#events[stream
403events]. For this the service user must have the
404link:access-control.html#capability_streamEvents[Stream Events] global
405capability assigned.
406
Edwin Kempin77167752014-07-16 08:21:06 +0200407[[commit-validation]]
408== Commit Validation
409
410Gerrit provides an
411link:https://gerrit-review.googlesource.com/Documentation/config-validation.html#new-commit-validation[
Marian Harbach34253372019-12-10 18:01:31 +0100412extension point to do validation of new commits,role=external,window=_blank]. A Gerrit plugin
Edwin Kempin77167752014-07-16 08:21:06 +0200413implementing this extension point can perform validation checks when
414new commits are pushed to Gerrit. The plugin can either provide a
415message to the client or reject the commit and cause the push to fail.
416
417There are some plugins available that provide commit validation:
418
David Pursehouse122f0782018-09-28 13:45:23 +0900419- link:https://gerrit-review.googlesource.com/admin/repos/plugins/uploadvalidator[
Marian Harbach34253372019-12-10 18:01:31 +0100420 uploadvalidator,role=external,window=_blank]:
Edwin Kempin77167752014-07-16 08:21:06 +0200421+
422The `uploadvalidator` plugin allows project owners to configure blocked
423file extensions, required footers and a maximum allowed path length.
424
David Pursehouse122f0782018-09-28 13:45:23 +0900425- link:https://gerrit-review.googlesource.com/admin/repos/plugins/commit-message-length-validator[
Marian Harbach34253372019-12-10 18:01:31 +0100426 commit-message-length-validator,role=external,window=_blank]
Edwin Kempin77167752014-07-16 08:21:06 +0200427+
428The `commit-message-length-validator` core plugin validates that commit
429messages conform to line length limits.
430
Edwin Kempin34f4f882014-04-22 16:13:18 +0200431[[branch-administration]]
432== Branch Administration
433
434As project owner you can administrate the branches of your project in
Edwin Kempin99700ff2024-01-19 08:12:03 +0000435the Gerrit Web UI under `BROWSE` > `Repositories` > <your project> >
Hugo Arès5187d672018-03-19 13:04:01 -0400436`Branches`. In the Web UI link:project-configuration.html#branch-creation[
437branch creation] is allowed if you have
438link:access-control.html#category_create[Create Reference] access right and
439link:project-configuration.html#branch-deletion[branch deletion] is allowed if
440you have the link:access-control.html#category_delete[Delete Reference] or the
441link:access-control.html#category_push[Push] access right with the `force`
442option.
Edwin Kempin34f4f882014-04-22 16:13:18 +0200443
444By setting `HEAD` on the project you can define its
Stefan Lay08ba4732014-05-05 16:36:12 +0200445link:project-configuration.html#default-branch[default branch]. For convenience
Edwin Kempin34f4f882014-04-22 16:13:18 +0200446reasons, when the repository is cloned Git creates a local branch for
447this default branch and checks it out.
448
Edwin Kempinef2b6af2014-04-22 11:04:10 +0200449[[notifications]]
450== Email Notifications
451
452With Gerrit individual users control their own email subscriptions. By
David Pursehousea1d633b2014-05-02 17:21:02 +0900453editing the link:user-notify.html#user[watched projects] in the Web UI
Edwin Kempin99700ff2024-01-19 08:12:03 +0000454under `Settings` > `Notifications` users can decide which events to
Edwin Kempinef2b6af2014-04-22 11:04:10 +0200455be informed about by email. The change notifications can be filtered by
456link:user-search.html[change search expressions].
457
458This means as a project owner you normally don't need to do anything
459about email notifications, except maybe telling your project team where
460to configure the watches.
461
462Gerrit also supports link:user-notify.html#project[notifications on
463project level] that allow project owners to set up email notifications
464for team mailing lists or groups of users. This configuration is done
465in the `project.config` file in the `refs/meta/config` branch as
466explained in the section about link:user-notify.html#project[project
467level notifications].
468
Edwin Kempin09c49602014-04-22 11:33:00 +0200469[[dashboards]]
470== Dashboards
471
472Gerrit comes with a pre-defined user dashboard that provides a view
473of the changes that are relevant for a user. Users can also define
474their own link:user-dashboards.html[custom dashboards] where the
475dashboard sections can be freely configured. As a project owner you can
476configure such custom dashboards on
477link:user-dashboards.html#project-dashboards[project level]. This way
478you can define a view of the changes that are relevant for your
479project and share this dashboard with all users. The project dashboards
Edwin Kempin99700ff2024-01-19 08:12:03 +0000480can be seen in the Web UI under `BROWSE` > `Repositories` > <your project>
481> `Dashboards`.
Edwin Kempin09c49602014-04-22 11:33:00 +0200482
Edwin Kempin96cdad42014-04-22 13:30:56 +0200483[[issue-tracker-integration]]
484== Issue Tracker Integration
485
486There are several possibilities to integrate issue trackers with
487Gerrit.
488
489- Comment Links
490+
Edwin Kempin8691f5a2014-04-30 09:21:57 +0200491As described in the link:#comment-links[Comment Links] section, comment
Edwin Kempin96cdad42014-04-22 13:30:56 +0200492links can be used to link IDs from commit message footers to issues in
493an issue tracker system.
494
495- Tracking IDs
496+
497Gerrit can be configured to index IDs from commit message footers so
498that the link:user-search.html#tr[tr/bug] search operators can be used
499to query for changes with a certain ID. The
500link:config-gerrit.html#trackingid[configuration of tracking IDs] can
501only be done globally by a Gerrit administrator.
502
503- Issue Tracker System Plugins
504+
505There are Gerrit plugins for a tight integration with
Marian Harbach34253372019-12-10 18:01:31 +0100506link:https://gerrit-review.googlesource.com//admin/repos/plugins/its-jira[Jira,role=external,window=_blank],
507link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-bugzilla[Bugzilla,role=external,window=_blank] and
508link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-rtc[IBM Rational Team Concert,role=external,window=_blank].
Edwin Kempin96cdad42014-04-22 13:30:56 +0200509If installed, these plugins can e.g. be used to automatically add links
510to Gerrit changes to the issues in the issue tracker system or to
511automatically close an issue if the corresponding change is merged.
512If installed, project owners may enable/disable the issue tracker
Edwin Kempin99700ff2024-01-19 08:12:03 +0000513integration from the Gerrit Web UI under `BROWSE` > `Repositories` >
Edwin Kempin96cdad42014-04-22 13:30:56 +0200514<your project> > `General`.
515
516[[comment-links]]
517== Comment Links
518
519Gerrit can linkify strings in commit messages, summary comments and
520inline comments. A string that matches a defined regular expression is
521then displayed as hyperlink to a configured backend system.
522
523So called comment links can be configured globally by a Gerrit
524administrator, but also per project by the project owner. Comment links
525on project level are defined in the `project.config` file in the
526`refs/meta/config` branch of the project as described in the
527documentation of the link:config-gerrit.html#commentlink[commentlink]
528configuration parameter.
529
530Often comment links are used to link an ID in a commit message footer
531to an issue in an issue tracker system. For example, to link the ID
532from the `Bug` footer to Jira the following configuration can be used:
533
Michael Ochmannb99feab2016-07-06 14:10:22 +0200534----
Edwin Kempin96cdad42014-04-22 13:30:56 +0200535 [commentlink "myjira"]
536 match = ([Bb][Uu][Gg]:\\s+)(\\S+)
537 link = https://myjira/browse/$2
Michael Ochmannb99feab2016-07-06 14:10:22 +0200538----
Edwin Kempin96cdad42014-04-22 13:30:56 +0200539
Edwin Kempin5d803952014-04-24 14:19:42 +0200540[[reviewers]]
541== Reviewers
542
543Normally it is not needed to explicitly assign reviewers to every
544change since the project members either link:user-notify.html#user[
545watch the project] and get notified by email or regularly check the
David Pursehousea1d633b2014-05-02 17:21:02 +0900546list of open changes in the Gerrit Web UI. The project members then
Edwin Kempin5d803952014-04-24 14:19:42 +0200547pick the changes themselves that are interesting to them for review.
548
549If authors of changes want to have a review by a particular person
550(e.g. someone who is known to be expert in the touched code area, or a
551stakeholder for the implemented feature), they can request the review
David Pursehousea1d633b2014-05-02 17:21:02 +0900552by adding this person in the Gerrit Web UI as a reviewer on the change.
Edwin Kempin5d803952014-04-24 14:19:42 +0200553Gerrit will then notify this person by email about the review request.
554
David Pursehouse122f0782018-09-28 13:45:23 +0900555With the link:https://gerrit-review.googlesource.com/admin/repos/plugins/reviewers[
Marian Harbach34253372019-12-10 18:01:31 +0100556reviewers,role=external,window=_blank] plugin it is possible to configure default reviewers who
Edwin Kempin5d803952014-04-24 14:19:42 +0200557will be automatically added to each change. The default reviewers can
Edwin Kempin99700ff2024-01-19 08:12:03 +0000558be configured in the Gerrit Web UI under `BROWSE` > `Repositories` >
Edwin Kempin5d803952014-04-24 14:19:42 +0200559<your project> > `General` in the `reviewers Plugin` section.
560
David Pursehouse122f0782018-09-28 13:45:23 +0900561The link:https://gerrit-review.googlesource.com/admin/repos/plugins/reviewers-by-blame[
Marian Harbach34253372019-12-10 18:01:31 +0100562reviewers-by-blame,role=external,window=_blank] plugin can automatically add reviewers to changes
Edwin Kempin5d803952014-04-24 14:19:42 +0200563based on the link:https://www.kernel.org/pub/software/scm/git/docs/git-blame.html[
Marian Harbach34253372019-12-10 18:01:31 +0100564git blame,role=external,window=_blank] computation on the changed files. This means that the plugin
Edwin Kempin5d803952014-04-24 14:19:42 +0200565will add those users as reviewer that authored most of the lines
566touched by the change, since these users should be familiar with the
567code and can most likely review the change. How many reviewers the
568plugin will add to a change at most can be configured in the Gerrit
Edwin Kempin99700ff2024-01-19 08:12:03 +0000569Web UI under `BROWSE` > `Repositories` > <your project> > `General` in the
Edwin Kempin5d803952014-04-24 14:19:42 +0200570`reviewers-by-blame Plugin` section.
571
Edwin Kempine622b792014-04-23 13:06:57 +0200572[[download-commands]]
573== Download Commands
574
575On the change screen in the `Downloads` drop-down panel Gerrit offers
576commands for downloading the currently viewed patch set.
577
578The download commands are implemented by Gerrit plugins. This means
579that the available download commands depend on the installed Gerrit
580plugins:
581
David Pursehouse122f0782018-09-28 13:45:23 +0900582- link:https://gerrit-review.googlesource.com/admin/repos/plugins/download-commands[
Marian Harbach34253372019-12-10 18:01:31 +0100583 download-commands,role=external,window=_blank] plugin:
Edwin Kempine622b792014-04-23 13:06:57 +0200584+
585The `download-commands` plugin provides the default download commands
586(`Checkout`, `Cherry Pick`, `Format Patch` and `Pull`).
587+
588Gerrit administrators may configure which of the commands are shown on
589the change screen.
590
David Pursehouse122f0782018-09-28 13:45:23 +0900591- link:https://gerrit-review.googlesource.com/admin/repos/plugins/project-download-commands[
Marian Harbach34253372019-12-10 18:01:31 +0100592 project-download-commands,role=external,window=_blank] plugin:
Edwin Kempine622b792014-04-23 13:06:57 +0200593+
594The `project-download-commands` plugin enables project owners to
595configure project-specific download commands. For example, a
596project-specific download command may update submodules, trigger a
597build, execute the tests or even do a deployment.
598+
599The project-specific download commands must be configured in the
600`project.config` file in the `refs/meta/config` branch of the project:
601+
Michael Ochmannb99feab2016-07-06 14:10:22 +0200602----
Edwin Kempine622b792014-04-23 13:06:57 +0200603 [plugin "project-download-commands"]
David Ostrovskyfdbfcad2016-11-15 06:35:29 -0800604 Build = git fetch ${url} ${ref} && git checkout FETCH_HEAD && bazel build ${project}
Edwin Kempine622b792014-04-23 13:06:57 +0200605 Update = git fetch ${url} ${ref} && git checkout FETCH_HEAD && git submodule update
Michael Ochmannb99feab2016-07-06 14:10:22 +0200606----
Edwin Kempine622b792014-04-23 13:06:57 +0200607+
608Project-specific download commands that are defined on a parent project
609are inherited by the child projects. A child project can overwrite an
610inherited download command, or remove it by assigning no value to it.
Edwin Kempin96cdad42014-04-22 13:30:56 +0200611
Edwin Kempin15199792014-04-23 16:22:05 +0200612[[tool-integration]]
613== Integration with other tools
614
615Gerrit provides many possibilities for the integration with other
616tools:
617
618- Stream Events:
619+
620The link:cmd-stream-events.html[stream-events] SSH command allows to
621listen to Gerrit link:cmd-stream-events.html#events[events]. Other
622tools can use this to react on actions done in Gerrit.
623+
624The link:access-control.html#capability_streamEvents[Stream Events]
625global capability is required for using the `stream-events` command.
626
627- REST API:
628+
629Gerrit provides a rich link:rest-api.html[REST API] that other tools
630can use to query information from Gerrit and and to trigger actions in
631Gerrit.
632
633- Gerrit Plugins:
634+
635The Gerrit functionality can be extended by plugins and there are many
636extension points, e.g. plugins can
637+
Ben Rohlfsda0a62b2021-04-26 17:02:19 +0200638** link:pg-plugin-admin-api.html[add new menu entries]
639** link:pg-plugin-endpoints.html[hook into DOM elements] and
640 link:pg-plugin-dev.html#plugin-screen[add new pages]
Edwin Kempin15199792014-04-23 16:22:05 +0200641** link:config-validation.html[do validation], e.g. of new commits
642** add new REST endpoints and link:dev-plugins.html#ssh[SSH commands]
643
644+
645How to develop a Gerrit plugin is described in the link:dev-plugins.html[
646Plugin Development] section.
647
David Pursehousea61ee502016-09-06 16:27:09 +0900648[[project-lifecycle]]
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200649== Project Lifecycle
650
651[[project-creation]]
652=== Project Creation
653
Edwin Kempin99700ff2024-01-19 08:12:03 +0000654New projects can be created in the Gerrit Web UI under `BROWSE` >
655`Repositories` and then clicking on the `CREATE NEW` button in the
656upper right corner. The `CREATE NEW` button is only available if you
657have the link:access-control.html#capability_createProject[
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200658Create Project] global capability assigned.
659
660Projects can also be created via REST or SSH as described in the
Stefan Lay08ba4732014-05-05 16:36:12 +0200661link:project-configuration.html#project-creation[Project Setup] section.
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200662
663Creating the project with an initial empty commit is generally
664recommended because some tools have issues with cloning repositories
665that are completely empty. However, if you plan to link:#import-history[
666import an existing history] into the new project, it is better to
667create the project without an initial empty commit.
668
669[[import-history]]
670=== Import Existing History
671
672If you have an existing history you can import it into a Gerrit
673project. To do this you need to have a local Git repository that
674contains this history. If your existing codebase is in another VCS you
675must migrate it to Git first. For Subversion you can use the
676link:http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion[
Marian Harbach34253372019-12-10 18:01:31 +0100677git svn,role=external,window=_blank] command as described in the
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200678link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Subversion[
Marian Harbach34253372019-12-10 18:01:31 +0100679Subversion migration guide,role=external,window=_blank]. An importer for Perforce is available in
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200680the `contrib` section of the Git source code; how to use
Marian Harbach34253372019-12-10 18:01:31 +0100681link:http://git-scm.com/docs/git-p4[git p4,role=external,window=_blank] to do the import from
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200682Perforce is described in the
683link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Perforce[
Marian Harbach34253372019-12-10 18:01:31 +0100684Perforce migration guide,role=external,window=_blank].
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200685
686To import an existing history into a Gerrit project you bypass code
687review and push it directly to `refs/heads/<branch>`. For this you must
688have the corresponding link:access-control.html#category_push_direct[
689Push] access right assigned. If the destination branch in the Gerrit
690repository already contains a history (e.g. an initial empty commit),
691you can overwrite it by doing a force push. In this case force push
692must be allowed in the access controls of the project.
693
694Some Gerrit servers may disallow forging committers by blocking the
695link:access-control.html#category_forge_committer[Forge Committer]
696access right globally. In this case you must use the
697link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
Marian Harbach34253372019-12-10 18:01:31 +0100698git filter-branch,role=external,window=_blank] command to rewrite the committer information for all
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200699commits (the author information that records who was writing the code
700stays intact; signed tags will lose their signature):
701
Michael Ochmannb99feab2016-07-06 14:10:22 +0200702----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200703 $ 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 +0200704----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200705
706If a link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
707limit] is configured on the server you may need to remove large objects
708from the history before you are able to push. To find large objects in
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200709the history of your project you can use the `reposize.sh` script which
710you can download from Gerrit:
711
Michael Ochmannb99feab2016-07-06 14:10:22 +0200712----
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200713 $ curl -Lo reposize.sh http://review.example.com:8080/tools/scripts/reposize.sh
714
715or
716
717 $ scp -p -P 29418 john.doe@review.example.com:scripts/reposize.sh .
Michael Ochmannb99feab2016-07-06 14:10:22 +0200718----
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200719
720You can then use the
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200721link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
722git filter-branch] command to remove the large objects from the history
723of all branches:
724
Michael Ochmannb99feab2016-07-06 14:10:22 +0200725----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200726 $ git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch path/to/large-file.jar' -- --all
Michael Ochmannb99feab2016-07-06 14:10:22 +0200727----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200728
729Since this command rewrites all commits in the repository it's a good
730idea to create a fresh clone from this rewritten repository before
731pushing to Gerrit, this will ensure that the original objects which
732have been rewritten are removed.
733
734[[project-deletion]]
735=== Project Deletion
736
737Gerrit core does not support the deletion of projects.
738
David Pursehouse122f0782018-09-28 13:45:23 +0900739If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/delete-project[
Marian Harbach34253372019-12-10 18:01:31 +0100740delete-project,role=external,window=_blank] plugin is installed, projects can be deleted from the
Edwin Kempin99700ff2024-01-19 08:12:03 +0000741Gerrit Web UI under `BROWSE` > `Repositories` > <project> > `General` by
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200742clicking on the `Delete` command under `Project Commands`. The `Delete`
Edwin Kempin56bac942014-04-24 14:25:42 +0200743command is only available if you have the `Delete Projects` global
744capability assigned, or if you own the project and you have the
745`Delete Own Projects` global capability assigned. If neither of these
746capabilities is granted, you need to contact a Gerrit administrator to
747request the deletion of your project.
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200748
749Instead of deleting a project you may set the
Stefan Lay08ba4732014-05-05 16:36:12 +0200750link:project-configuration.html#project-state[project state] to `ReadOnly` or
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200751`Hidden`.
752
753[[project-rename]]
754=== Project Rename
755
756Gerrit core does not support the renaming of projects.
757
Matthias Sohn536f0022020-02-17 16:08:12 +0100758If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/rename-project[rename-project]
759plugin is installed, projects can be renamed using the
760link:https://gerrit.googlesource.com/plugins/rename-project/+/refs/heads/master/src/main/resources/Documentation/cmd-rename.md[rename-project]
Marco Millere0556132020-02-18 14:38:04 -0500761ssh command.
762
763Find details about prerequisites in the
Matthias Sohn536f0022020-02-17 16:08:12 +0100764link:https://gerrit.googlesource.com/plugins/rename-project/+/refs/heads/master/src/main/resources/Documentation/about.md[plugin documentation].
765
766If you don't want to use the rename-project plugin you can perform the following steps as
767a workaround:
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200768
David Shevitz7f9b34d2018-03-19 13:24:57 -0700769. link:#project-creation[Create a new project] with the new name.
770. link:#import-history[Import the history of the old project].
771. link:#project-deletion[Delete the old project].
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200772
Edwin Kempinec86ca12015-04-17 10:03:30 +0200773Please note that a drawback of this workaround is that the whole review
774history (changes, review comments) is lost.
775
Edwin Kempin4bf01962014-04-16 16:47:10 +0200776GERRIT
777------
778Part of link:index.html[Gerrit Code Review]
779
780SEARCHBOX
781---------