blob: 97b58afc494421fd8871392a8f31fe2583b28d62 [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 Kempin4bf01962014-04-16 16:47:10 +020047- click on the `Projects` > `List` menu entry
48- 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 Kempin4bf01962014-04-16 16:47:10 +0200153on the `Groups` > `List` menu entry. By clicking on a group you can
154edit 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
171New internal Gerrit groups can be created under `Groups` >
172`Create New Group`. This menu is only available if you have the global
173capability link:access-control.html#capability_createGroup[Create Group]
174assigned.
175
176Gerrit also has a set of special
177link:access-control.html#system_groups[system groups] that you might
178find useful.
179
180External groups need to be prefixed when assigning access rights to
181them, e.g. link:access-control.html#ldap_groups[LDAP group names] need
182to be prefixed with `ldap/`.
183
David Pursehouse122f0782018-09-28 13:45:23 +0900184If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/singleusergroup[
Marian Harbach34253372019-12-10 18:01:31 +0100185singleusergroup,role=external,window=_blank] plugin is installed you can also directly assign
Edwin Kempin4bf01962014-04-16 16:47:10 +0200186access rights to users, by prefixing the username with `user/` or the
187user's account ID by `userid/`.
188
189[[common-access-rights]]
190=== Common Access Rights
191
192Different roles in a project, such as developer (committer) or
193contributor, need different access rights. Examples for which access
194rights are typically assigned for which role are described in the
195link:access-control.html#example_roles[Access Control] chapter.
196
197[[code-review]]
198=== Code Review
199
200Gerrit's main functionality is code review, however using code review
201is optional and you may decide to only use Gerrit as a Git server with
202access control. Whether you allow only pushes for review or also
203direct pushes depends on the project's access rights.
204
205To push a commit for review it must be pushed to
206link:access-control.html#refs_for[refs/for/<branch-name>]. This means
207the link:access-control.html#category_push_review[Push] access right
208must be assigned on `refs/for/<branch-name>`.
209
210To allow direct pushes and bypass code review, the
211link:access-control.html#category_push_direct[Push] access right is
212required on `refs/heads/<branch-name>`.
213
214By pushing for review you are not only enabling the review workflow,
Edwin Kempincee50e72014-04-24 09:40:22 +0200215but you can also get link:#continuous-integration[automatic
216verifications from a build server] before changes are merged. In
217addition you can benefit from Gerrit's merge strategies that can
218automatically merge/rebase commits on server side if necessary. You can
219control the merge strategy by configuring the
Changcheng Xiao21885982019-01-15 18:16:51 +0100220link:config-project-config.html#submit-type[submit type] on the project. If you
Edwin Kempincee50e72014-04-24 09:40:22 +0200221bypass code review you always need to merge/rebase manually if the tip
222of the destination branch has moved. Please keep this in mind if you
223choose to not work with code review because you think it's easier to
224avoid the additional complexity of the review workflow; it might
225actually not be easier.
Edwin Kempin4bf01962014-04-16 16:47:10 +0200226
227You may also enable link:user-upload.html#auto_merge[auto-merge on
228push] to benefit from the automatic merge/rebase on server side while
229pushing directly into the repository.
230
Edwin Kempineaff6c12014-04-17 15:23:42 +0200231[[project-options]]
232== Project Options
233
234As project owner you can control several options on your project.
235The different options are described in the
Stefan Lay08ba4732014-05-05 16:36:12 +0200236link:project-configuration.html#project_options[Project Options] section.
Edwin Kempineaff6c12014-04-17 15:23:42 +0200237
David Shevitz7f9b34d2018-03-19 13:24:57 -0700238To see the options of your project:
Edwin Kempineaff6c12014-04-17 15:23:42 +0200239
David Shevitz7f9b34d2018-03-19 13:24:57 -0700240. Go to the Gerrit Web UI.
241. Click on the `Projects` > `List` menu entry.
242. Find your project in the project list and click it.
243. Click the `General` menu entry.
Edwin Kempineaff6c12014-04-17 15:23:42 +0200244
245[[submit-type]]
246=== Submit Type
247
248An important decision for a project is the choice of the submit type
Sebastian Schuberth774aac92015-04-16 13:21:04 +0200249and the content merge setting (see the `Allow content merges` option).
Changcheng Xiao21885982019-01-15 18:16:51 +0100250The link:config-project-config.html#submit-type[submit type] is the method
Edwin Kempineaff6c12014-04-17 15:23:42 +0200251Gerrit uses to submit a change to the project. The submit type defines
252what Gerrit should do on submit of a change if the destination branch
253has moved while the change was in review. The
Stefan Lay08ba4732014-05-05 16:36:12 +0200254link:project-configuration.html#content_merge[content merge] setting applies
Edwin Kempineaff6c12014-04-17 15:23:42 +0200255if the same files have been modified concurrently and tells Gerrit
256whether it should attempt a content merge for these files.
257
258When choosing the submit type and the content merge setting one must
259weigh development comfort against the safety of not breaking the
260destination branch.
261
262The most restrictive submit type is
Stefan Lay08ba4732014-05-05 16:36:12 +0200263link:project-configuration.html#fast_forward_only[Fast Forward Only]. Using
Edwin Kempineaff6c12014-04-17 15:23:42 +0200264this submit type means that after submitting one change all other open
265changes for the same destination branch must be rebased manually. This
266is quite burdensome and in practice only feasible for branches with
267very few changes. On the other hand, if changes are verified before
268submit, e.g. automatically by a CI integration, with this submit type,
269you can be sure that the destination branch never gets broken.
270
Stefan Lay08ba4732014-05-05 16:36:12 +0200271Choosing link:project-configuration.html#merge_if_necessary[Merge If Necessary]
Edwin Kempineaff6c12014-04-17 15:23:42 +0200272as submit type makes the life for developers more comfortable,
273especially if content merge is enabled. If this submit strategy is used
274developers only need to rebase manually if the same files have been
275modified concurrently or if the content merge on such a file fails. The
276drawback with this submit type is that there is a risk of breaking
277the destination branch, e.g. if one change moves a class into another
278package and another change imports this class from the old location.
279Experience shows that in practice `Merge If Necessary` with content
280merge enabled works pretty well and breaking the destination branch
281happens rarely. This is why this setting is recommended at least for
282development branches. You likely want to start with
283`Merge If Necessary` with content merge enabled and only switch to a
284more restrictive policy if you are facing issues with the build and
285test stability of the destination branches.
286
Edwin Kempin1781adb2014-04-22 10:02:40 +0200287It is also possible to define the submit type dynamically via
288link:#prolog-submit-type[Prolog]. This way you can use different submit
289types for different branches.
290
Edwin Kempineaff6c12014-04-17 15:23:42 +0200291Please note that there are other submit types available; they are
Changcheng Xiao21885982019-01-15 18:16:51 +0100292described in the link:config-project-config.html#submit-type[Submit Type]
Edwin Kempineaff6c12014-04-17 15:23:42 +0200293section.
294
Edwin Kempin1781adb2014-04-22 10:02:40 +0200295[[labels]]
296== Labels
297
298The code review process includes that reviewers formally express their
299opinion about a change by voting on different link:config-labels.html[
300labels]. By default Gerrit comes with the
301link:config-labels.html#label_Code-Review[Code-Review] label and many
302Gerrit servers have the link:config-labels.html#label_Verified[Verified]
303label configured globally. However projects can also define their own
304link:config-labels.html#label_custom[custom labels] to formalize
305project-specific workflows. For example if a project requires an IP
306approval from a special IP-team, it can define an `IP-Review` label
307and grant permissions to the IP-team to vote on this label.
308
309The behavior of a label can be controlled by its
310link:config-labels.html#label_function[function], e.g. it can be
311configured whether a max positive voting on the label is required for
312submit or if the voting on the label is optional.
313
314By using a custom link:#submit-rules[submit rule] it can be controlled
315per change whether a label is required for submit or not.
316
317A useful feature on labels is the possibility to automatically copy
318scores forward to new patch sets if it was a
Edwin Kempin0ff93072022-04-05 14:25:11 +0200319link:config-labels.html#trivial_rebase[trivial rebase] or if
320link:config-labels.html#no_code_change[there was no code change] (e.g.
321only the commit message was edited).
Edwin Kempin1781adb2014-04-22 10:02:40 +0200322
323[[submit-rules]]
324== Submit Rules
325
326A link:prolog-cookbook.html#SubmitRule[submit rule] in Gerrit is logic
327that defines when a change is submittable. By default, a change is
328submittable when it gets at least one highest vote on each label and
329has no lowest vote (aka veto vote) on any label.
330
331The submit rules in Gerrit are implemented in link:prolog-cookbook.html[
332Prolog] and projects that need more flexibility can define their own
333submit rules to decide when a change should be submittable. A good
334link:prolog-cookbook.html#NonAuthorCodeReview[example] from the Prolog
335cookbook shows how to allow submit only if a change has a
336`Code-Review+2` vote from a person that is not the change author. This
337way a four-eyes principle for the reviews can be enforced.
338
339A Prolog submit rule has access to link:prolog-change-facts.html[
340information] about the change for which it is testing the
Eryk Szymanski2b93eb02016-11-15 17:56:28 -0800341submittability. Among others the list of the modified files can be
Edwin Kempin1781adb2014-04-22 10:02:40 +0200342accessed, which allows special logic if certain files are touched. For
343example, a common practice is to require a vote on an additional label,
344like `Library-Compliance`, if the dependencies of the project are
345changed.
346
347[[prolog-submit-type]]
348It is also possible to control the link:prolog-cookbook.html#SubmitType[
349submit type] from Prolog. For example this can be used to define a more
350restrictive submit type such as `Fast Forward Only` for stable branches
351while using a more liberal submit type, e.g. `Merge If Necessary` with
352content merge, for development branches. How this can be done can be
353seen from an link:prolog-cookbook.html#SubmitTypePerBranch[example] in
354the Prolog cookbook.
355
356Submit rules are maintained in the link:prolog-cookbook.html#RulesFile[
357rules.pl] file in the `refs/meta/config` branch of the project. How to
358write submit rules is explained in the
359link:prolog-cookbook.html#HowToWriteSubmitRules[Prolog cookbook]. There
360is also good support for link:prolog-cookbook.html#TestingSubmitRules[
361testing submit rules] while developing them.
362
Edwin Kempin693888a2014-04-23 13:50:24 +0200363[[continuous-integration]]
364== Continuous Integration
365
366With Gerrit you can have continuous integration builds not only for
367updates of central branches but also whenever a new change/patch set is
368uploaded for review. This way you get automatic verification of all
369changes *before* they are merged and any build and test issues are
370detected early. To indicate the build and test status the continuous
371integration system normally votes with the
372link:config-labels.html#label_Verified[Verified] label on the change.
373
374There are several solutions for integrating continuous integration
375systems. The most commonly used are:
376
Edwin Kempin862b49e2022-07-13 10:48:45 +0200377- link:https://plugins.jenkins.io/gerrit-trigger/[
Marian Harbach34253372019-12-10 18:01:31 +0100378 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 +0200379
380- link:http://www.mediawiki.org/wiki/Continuous_integration/Zuul[
Marian Harbach34253372019-12-10 18:01:31 +0100381 Zuul,role=external,window=_blank] for link:http://jenkins-ci.org/[Jenkins,role=external,window=_blank]
Edwin Kempin693888a2014-04-23 13:50:24 +0200382
383For the integration with the continuous integration system you must
384have a service user that is able to access Gerrit. To create a service
385user in Gerrit you can use the link:cmd-create-account.html[create-account]
386SSH command if the link:access-control.html#capability_createAccount[
387Create Account] global capability is granted. If not, you need to ask
388a Gerrit administrator to create the service user.
389
David Pursehouse122f0782018-09-28 13:45:23 +0900390If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/serviceuser[
Marian Harbach34253372019-12-10 18:01:31 +0100391serviceuser,role=external,window=_blank] plugin is installed you can also create new service users
David Pursehousea1d633b2014-05-02 17:21:02 +0900392in the Gerrit Web UI under `People` > `Create Service User`. For this
Edwin Kempin5d6b9f12014-04-24 14:30:07 +0200393the `Create Service User` global capability must be assigned.
Edwin Kempin693888a2014-04-23 13:50:24 +0200394
395The service user must have link:access-control.html#category_read[read]
396access to your project. In addition, if automatic change verification
397is enabled, the service user must be allowed to vote on the
398link:config-labels.html#label_Verified[Verified] label.
399
400Continuous integration systems usually integrate with Gerrit by
401listening to the Gerrit link:cmd-stream-events.html#events[stream
402events]. For this the service user must have the
403link:access-control.html#capability_streamEvents[Stream Events] global
404capability assigned.
405
Edwin Kempin77167752014-07-16 08:21:06 +0200406[[commit-validation]]
407== Commit Validation
408
409Gerrit provides an
410link:https://gerrit-review.googlesource.com/Documentation/config-validation.html#new-commit-validation[
Marian Harbach34253372019-12-10 18:01:31 +0100411extension point to do validation of new commits,role=external,window=_blank]. A Gerrit plugin
Edwin Kempin77167752014-07-16 08:21:06 +0200412implementing this extension point can perform validation checks when
413new commits are pushed to Gerrit. The plugin can either provide a
414message to the client or reject the commit and cause the push to fail.
415
416There are some plugins available that provide commit validation:
417
David Pursehouse122f0782018-09-28 13:45:23 +0900418- link:https://gerrit-review.googlesource.com/admin/repos/plugins/uploadvalidator[
Marian Harbach34253372019-12-10 18:01:31 +0100419 uploadvalidator,role=external,window=_blank]:
Edwin Kempin77167752014-07-16 08:21:06 +0200420+
421The `uploadvalidator` plugin allows project owners to configure blocked
422file extensions, required footers and a maximum allowed path length.
423
David Pursehouse122f0782018-09-28 13:45:23 +0900424- link:https://gerrit-review.googlesource.com/admin/repos/plugins/commit-message-length-validator[
Marian Harbach34253372019-12-10 18:01:31 +0100425 commit-message-length-validator,role=external,window=_blank]
Edwin Kempin77167752014-07-16 08:21:06 +0200426+
427The `commit-message-length-validator` core plugin validates that commit
428messages conform to line length limits.
429
Edwin Kempin34f4f882014-04-22 16:13:18 +0200430[[branch-administration]]
431== Branch Administration
432
433As project owner you can administrate the branches of your project in
David Pursehousea1d633b2014-05-02 17:21:02 +0900434the Gerrit Web UI under `Projects` > `List` > <your project> >
Hugo Arès5187d672018-03-19 13:04:01 -0400435`Branches`. In the Web UI link:project-configuration.html#branch-creation[
436branch creation] is allowed if you have
437link:access-control.html#category_create[Create Reference] access right and
438link:project-configuration.html#branch-deletion[branch deletion] is allowed if
439you have the link:access-control.html#category_delete[Delete Reference] or the
440link:access-control.html#category_push[Push] access right with the `force`
441option.
Edwin Kempin34f4f882014-04-22 16:13:18 +0200442
443By setting `HEAD` on the project you can define its
Stefan Lay08ba4732014-05-05 16:36:12 +0200444link:project-configuration.html#default-branch[default branch]. For convenience
Edwin Kempin34f4f882014-04-22 16:13:18 +0200445reasons, when the repository is cloned Git creates a local branch for
446this default branch and checks it out.
447
Edwin Kempinef2b6af2014-04-22 11:04:10 +0200448[[notifications]]
449== Email Notifications
450
451With Gerrit individual users control their own email subscriptions. By
David Pursehousea1d633b2014-05-02 17:21:02 +0900452editing the link:user-notify.html#user[watched projects] in the Web UI
Edwin Kempinef2b6af2014-04-22 11:04:10 +0200453under `Settings` > `Watched Projects` users can decide which events to
454be informed about by email. The change notifications can be filtered by
455link:user-search.html[change search expressions].
456
457This means as a project owner you normally don't need to do anything
458about email notifications, except maybe telling your project team where
459to configure the watches.
460
461Gerrit also supports link:user-notify.html#project[notifications on
462project level] that allow project owners to set up email notifications
463for team mailing lists or groups of users. This configuration is done
464in the `project.config` file in the `refs/meta/config` branch as
465explained in the section about link:user-notify.html#project[project
466level notifications].
467
Edwin Kempin09c49602014-04-22 11:33:00 +0200468[[dashboards]]
469== Dashboards
470
471Gerrit comes with a pre-defined user dashboard that provides a view
472of the changes that are relevant for a user. Users can also define
473their own link:user-dashboards.html[custom dashboards] where the
474dashboard sections can be freely configured. As a project owner you can
475configure such custom dashboards on
476link:user-dashboards.html#project-dashboards[project level]. This way
477you can define a view of the changes that are relevant for your
478project and share this dashboard with all users. The project dashboards
David Pursehousea1d633b2014-05-02 17:21:02 +0900479can be seen in the Web UI under `Projects` > `List` > <your project> >
Edwin Kempin09c49602014-04-22 11:33:00 +0200480`Dashboards`.
481
Edwin Kempin96cdad42014-04-22 13:30:56 +0200482[[issue-tracker-integration]]
483== Issue Tracker Integration
484
485There are several possibilities to integrate issue trackers with
486Gerrit.
487
488- Comment Links
489+
Edwin Kempin8691f5a2014-04-30 09:21:57 +0200490As described in the link:#comment-links[Comment Links] section, comment
Edwin Kempin96cdad42014-04-22 13:30:56 +0200491links can be used to link IDs from commit message footers to issues in
492an issue tracker system.
493
494- Tracking IDs
495+
496Gerrit can be configured to index IDs from commit message footers so
497that the link:user-search.html#tr[tr/bug] search operators can be used
498to query for changes with a certain ID. The
499link:config-gerrit.html#trackingid[configuration of tracking IDs] can
500only be done globally by a Gerrit administrator.
501
502- Issue Tracker System Plugins
503+
504There are Gerrit plugins for a tight integration with
Marian Harbach34253372019-12-10 18:01:31 +0100505link:https://gerrit-review.googlesource.com//admin/repos/plugins/its-jira[Jira,role=external,window=_blank],
506link:https://gerrit-review.googlesource.com/admin/repos/plugins/its-bugzilla[Bugzilla,role=external,window=_blank] and
507link: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 +0200508If installed, these plugins can e.g. be used to automatically add links
509to Gerrit changes to the issues in the issue tracker system or to
510automatically close an issue if the corresponding change is merged.
511If installed, project owners may enable/disable the issue tracker
David Pursehousea1d633b2014-05-02 17:21:02 +0900512integration from the Gerrit Web UI under `Projects` > `Lists` >
Edwin Kempin96cdad42014-04-22 13:30:56 +0200513<your project> > `General`.
514
515[[comment-links]]
516== Comment Links
517
518Gerrit can linkify strings in commit messages, summary comments and
519inline comments. A string that matches a defined regular expression is
520then displayed as hyperlink to a configured backend system.
521
522So called comment links can be configured globally by a Gerrit
523administrator, but also per project by the project owner. Comment links
524on project level are defined in the `project.config` file in the
525`refs/meta/config` branch of the project as described in the
526documentation of the link:config-gerrit.html#commentlink[commentlink]
527configuration parameter.
528
529Often comment links are used to link an ID in a commit message footer
530to an issue in an issue tracker system. For example, to link the ID
531from the `Bug` footer to Jira the following configuration can be used:
532
Michael Ochmannb99feab2016-07-06 14:10:22 +0200533----
Edwin Kempin96cdad42014-04-22 13:30:56 +0200534 [commentlink "myjira"]
535 match = ([Bb][Uu][Gg]:\\s+)(\\S+)
536 link = https://myjira/browse/$2
Michael Ochmannb99feab2016-07-06 14:10:22 +0200537----
Edwin Kempin96cdad42014-04-22 13:30:56 +0200538
Edwin Kempin5d803952014-04-24 14:19:42 +0200539[[reviewers]]
540== Reviewers
541
542Normally it is not needed to explicitly assign reviewers to every
543change since the project members either link:user-notify.html#user[
544watch the project] and get notified by email or regularly check the
David Pursehousea1d633b2014-05-02 17:21:02 +0900545list of open changes in the Gerrit Web UI. The project members then
Edwin Kempin5d803952014-04-24 14:19:42 +0200546pick the changes themselves that are interesting to them for review.
547
548If authors of changes want to have a review by a particular person
549(e.g. someone who is known to be expert in the touched code area, or a
550stakeholder for the implemented feature), they can request the review
David Pursehousea1d633b2014-05-02 17:21:02 +0900551by adding this person in the Gerrit Web UI as a reviewer on the change.
Edwin Kempin5d803952014-04-24 14:19:42 +0200552Gerrit will then notify this person by email about the review request.
553
David Pursehouse122f0782018-09-28 13:45:23 +0900554With the link:https://gerrit-review.googlesource.com/admin/repos/plugins/reviewers[
Marian Harbach34253372019-12-10 18:01:31 +0100555reviewers,role=external,window=_blank] plugin it is possible to configure default reviewers who
Edwin Kempin5d803952014-04-24 14:19:42 +0200556will be automatically added to each change. The default reviewers can
David Pursehousea1d633b2014-05-02 17:21:02 +0900557be configured in the Gerrit Web UI under `Projects` > `List` >
Edwin Kempin5d803952014-04-24 14:19:42 +0200558<your project> > `General` in the `reviewers Plugin` section.
559
David Pursehouse122f0782018-09-28 13:45:23 +0900560The link:https://gerrit-review.googlesource.com/admin/repos/plugins/reviewers-by-blame[
Marian Harbach34253372019-12-10 18:01:31 +0100561reviewers-by-blame,role=external,window=_blank] plugin can automatically add reviewers to changes
Edwin Kempin5d803952014-04-24 14:19:42 +0200562based on the link:https://www.kernel.org/pub/software/scm/git/docs/git-blame.html[
Marian Harbach34253372019-12-10 18:01:31 +0100563git blame,role=external,window=_blank] computation on the changed files. This means that the plugin
Edwin Kempin5d803952014-04-24 14:19:42 +0200564will add those users as reviewer that authored most of the lines
565touched by the change, since these users should be familiar with the
566code and can most likely review the change. How many reviewers the
567plugin will add to a change at most can be configured in the Gerrit
David Pursehousea1d633b2014-05-02 17:21:02 +0900568Web UI under `Projects` > `List` > <your project> > `General` in the
Edwin Kempin5d803952014-04-24 14:19:42 +0200569`reviewers-by-blame Plugin` section.
570
Edwin Kempine622b792014-04-23 13:06:57 +0200571[[download-commands]]
572== Download Commands
573
574On the change screen in the `Downloads` drop-down panel Gerrit offers
575commands for downloading the currently viewed patch set.
576
577The download commands are implemented by Gerrit plugins. This means
578that the available download commands depend on the installed Gerrit
579plugins:
580
David Pursehouse122f0782018-09-28 13:45:23 +0900581- link:https://gerrit-review.googlesource.com/admin/repos/plugins/download-commands[
Marian Harbach34253372019-12-10 18:01:31 +0100582 download-commands,role=external,window=_blank] plugin:
Edwin Kempine622b792014-04-23 13:06:57 +0200583+
584The `download-commands` plugin provides the default download commands
585(`Checkout`, `Cherry Pick`, `Format Patch` and `Pull`).
586+
587Gerrit administrators may configure which of the commands are shown on
588the change screen.
589
David Pursehouse122f0782018-09-28 13:45:23 +0900590- link:https://gerrit-review.googlesource.com/admin/repos/plugins/project-download-commands[
Marian Harbach34253372019-12-10 18:01:31 +0100591 project-download-commands,role=external,window=_blank] plugin:
Edwin Kempine622b792014-04-23 13:06:57 +0200592+
593The `project-download-commands` plugin enables project owners to
594configure project-specific download commands. For example, a
595project-specific download command may update submodules, trigger a
596build, execute the tests or even do a deployment.
597+
598The project-specific download commands must be configured in the
599`project.config` file in the `refs/meta/config` branch of the project:
600+
Michael Ochmannb99feab2016-07-06 14:10:22 +0200601----
Edwin Kempine622b792014-04-23 13:06:57 +0200602 [plugin "project-download-commands"]
David Ostrovskyfdbfcad2016-11-15 06:35:29 -0800603 Build = git fetch ${url} ${ref} && git checkout FETCH_HEAD && bazel build ${project}
Edwin Kempine622b792014-04-23 13:06:57 +0200604 Update = git fetch ${url} ${ref} && git checkout FETCH_HEAD && git submodule update
Michael Ochmannb99feab2016-07-06 14:10:22 +0200605----
Edwin Kempine622b792014-04-23 13:06:57 +0200606+
607Project-specific download commands that are defined on a parent project
608are inherited by the child projects. A child project can overwrite an
609inherited download command, or remove it by assigning no value to it.
Edwin Kempin96cdad42014-04-22 13:30:56 +0200610
Edwin Kempin15199792014-04-23 16:22:05 +0200611[[tool-integration]]
612== Integration with other tools
613
614Gerrit provides many possibilities for the integration with other
615tools:
616
617- Stream Events:
618+
619The link:cmd-stream-events.html[stream-events] SSH command allows to
620listen to Gerrit link:cmd-stream-events.html#events[events]. Other
621tools can use this to react on actions done in Gerrit.
622+
623The link:access-control.html#capability_streamEvents[Stream Events]
624global capability is required for using the `stream-events` command.
625
626- REST API:
627+
628Gerrit provides a rich link:rest-api.html[REST API] that other tools
629can use to query information from Gerrit and and to trigger actions in
630Gerrit.
631
632- Gerrit Plugins:
633+
634The Gerrit functionality can be extended by plugins and there are many
635extension points, e.g. plugins can
636+
Ben Rohlfsda0a62b2021-04-26 17:02:19 +0200637** link:pg-plugin-admin-api.html[add new menu entries]
638** link:pg-plugin-endpoints.html[hook into DOM elements] and
639 link:pg-plugin-dev.html#plugin-screen[add new pages]
Edwin Kempin15199792014-04-23 16:22:05 +0200640** link:config-validation.html[do validation], e.g. of new commits
641** add new REST endpoints and link:dev-plugins.html#ssh[SSH commands]
642
643+
644How to develop a Gerrit plugin is described in the link:dev-plugins.html[
645Plugin Development] section.
646
David Pursehousea61ee502016-09-06 16:27:09 +0900647[[project-lifecycle]]
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200648== Project Lifecycle
649
650[[project-creation]]
651=== Project Creation
652
David Pursehousea1d633b2014-05-02 17:21:02 +0900653New projects can be created in the Gerrit Web UI under `Projects` >
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200654`Create Project`. The `Create Project` menu entry is only available if
655you have the link:access-control.html#capability_createProject[
656Create Project] global capability assigned.
657
658Projects can also be created via REST or SSH as described in the
Stefan Lay08ba4732014-05-05 16:36:12 +0200659link:project-configuration.html#project-creation[Project Setup] section.
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200660
661Creating the project with an initial empty commit is generally
662recommended because some tools have issues with cloning repositories
663that are completely empty. However, if you plan to link:#import-history[
664import an existing history] into the new project, it is better to
665create the project without an initial empty commit.
666
667[[import-history]]
668=== Import Existing History
669
670If you have an existing history you can import it into a Gerrit
671project. To do this you need to have a local Git repository that
672contains this history. If your existing codebase is in another VCS you
673must migrate it to Git first. For Subversion you can use the
674link:http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion[
Marian Harbach34253372019-12-10 18:01:31 +0100675git svn,role=external,window=_blank] command as described in the
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200676link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Subversion[
Marian Harbach34253372019-12-10 18:01:31 +0100677Subversion migration guide,role=external,window=_blank]. An importer for Perforce is available in
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200678the `contrib` section of the Git source code; how to use
Marian Harbach34253372019-12-10 18:01:31 +0100679link: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 +0200680Perforce is described in the
681link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Perforce[
Marian Harbach34253372019-12-10 18:01:31 +0100682Perforce migration guide,role=external,window=_blank].
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200683
684To import an existing history into a Gerrit project you bypass code
685review and push it directly to `refs/heads/<branch>`. For this you must
686have the corresponding link:access-control.html#category_push_direct[
687Push] access right assigned. If the destination branch in the Gerrit
688repository already contains a history (e.g. an initial empty commit),
689you can overwrite it by doing a force push. In this case force push
690must be allowed in the access controls of the project.
691
692Some Gerrit servers may disallow forging committers by blocking the
693link:access-control.html#category_forge_committer[Forge Committer]
694access right globally. In this case you must use the
695link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
Marian Harbach34253372019-12-10 18:01:31 +0100696git filter-branch,role=external,window=_blank] command to rewrite the committer information for all
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200697commits (the author information that records who was writing the code
698stays intact; signed tags will lose their signature):
699
Michael Ochmannb99feab2016-07-06 14:10:22 +0200700----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200701 $ 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 +0200702----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200703
704If a link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
705limit] is configured on the server you may need to remove large objects
706from the history before you are able to push. To find large objects in
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200707the history of your project you can use the `reposize.sh` script which
708you can download from Gerrit:
709
Michael Ochmannb99feab2016-07-06 14:10:22 +0200710----
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200711 $ curl -Lo reposize.sh http://review.example.com:8080/tools/scripts/reposize.sh
712
713or
714
715 $ scp -p -P 29418 john.doe@review.example.com:scripts/reposize.sh .
Michael Ochmannb99feab2016-07-06 14:10:22 +0200716----
Edwin Kempin5ba27bd2014-05-09 14:53:04 +0200717
718You can then use the
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200719link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
720git filter-branch] command to remove the large objects from the history
721of all branches:
722
Michael Ochmannb99feab2016-07-06 14:10:22 +0200723----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200724 $ git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch path/to/large-file.jar' -- --all
Michael Ochmannb99feab2016-07-06 14:10:22 +0200725----
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200726
727Since this command rewrites all commits in the repository it's a good
728idea to create a fresh clone from this rewritten repository before
729pushing to Gerrit, this will ensure that the original objects which
730have been rewritten are removed.
731
732[[project-deletion]]
733=== Project Deletion
734
735Gerrit core does not support the deletion of projects.
736
David Pursehouse122f0782018-09-28 13:45:23 +0900737If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/delete-project[
Marian Harbach34253372019-12-10 18:01:31 +0100738delete-project,role=external,window=_blank] plugin is installed, projects can be deleted from the
David Pursehousea1d633b2014-05-02 17:21:02 +0900739Gerrit Web UI under `Projects` > `List` > <project> > `General` by
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200740clicking on the `Delete` command under `Project Commands`. The `Delete`
Edwin Kempin56bac942014-04-24 14:25:42 +0200741command is only available if you have the `Delete Projects` global
742capability assigned, or if you own the project and you have the
743`Delete Own Projects` global capability assigned. If neither of these
744capabilities is granted, you need to contact a Gerrit administrator to
745request the deletion of your project.
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200746
747Instead of deleting a project you may set the
Stefan Lay08ba4732014-05-05 16:36:12 +0200748link:project-configuration.html#project-state[project state] to `ReadOnly` or
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200749`Hidden`.
750
751[[project-rename]]
752=== Project Rename
753
754Gerrit core does not support the renaming of projects.
755
Matthias Sohn536f0022020-02-17 16:08:12 +0100756If the link:https://gerrit-review.googlesource.com/admin/repos/plugins/rename-project[rename-project]
757plugin is installed, projects can be renamed using the
758link: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 -0500759ssh command.
760
761Find details about prerequisites in the
Matthias Sohn536f0022020-02-17 16:08:12 +0100762link:https://gerrit.googlesource.com/plugins/rename-project/+/refs/heads/master/src/main/resources/Documentation/about.md[plugin documentation].
763
764If you don't want to use the rename-project plugin you can perform the following steps as
765a workaround:
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200766
David Shevitz7f9b34d2018-03-19 13:24:57 -0700767. link:#project-creation[Create a new project] with the new name.
768. link:#import-history[Import the history of the old project].
769. link:#project-deletion[Delete the old project].
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200770
Edwin Kempinec86ca12015-04-17 10:03:30 +0200771Please note that a drawback of this workaround is that the whole review
772history (changes, review comments) is lost.
773
Edwin Kempin4bf01962014-04-16 16:47:10 +0200774GERRIT
775------
776Part of link:index.html[Gerrit Code Review]
777
778SEARCHBOX
779---------