blob: 6fc270bb298f69ef1d936c8963d8e3f92e7caee1 [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
13`refs/*` on that project. As project owner you have the permission to
14edit 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
45- go to the Gerrit WebUI
46- 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
66If a Git browser such as GitWeb is configured for the Gerrit server you
67can find a link to the history of the `project.config` file in the
68WebUI. Otherwise you may inspect the history locally. If you have
69cloned the repository you can do this by executing the following
70commands:
71
72====
73 $ git fetch origin refs/meta/config:config
74 $ git checkout config
75 $ git log project.config
76====
77
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
95Looking at the access rights of your project in the Gerrit WebUI, you
96only 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
114project in the WebUI, save the modifications for review and get the
115change 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
130A ref pattern ends with `/*` and describes a complete ref name
131namespace, e.g. access rights assigned on `refs/heads/*` apply to all
132branches.
133
134Regular expressions must start with `^`, e.g. access rights assigned
135on `^refs/heads/rel-.*` would apply to all `rel-*` branches.
136
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
144The Gerrit internal groups can be seen in the Gerrit WebUI by clicking
145on 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
212link:project-setup.html#submit_type[submit type] on the project. If you
213bypass 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
228link:project-setup.html#project_options[Project Options] section.
229
230To see the options of your project
231
232- go to the Gerrit WebUI
233- 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
241and the content merge setting (aka `Automatically resolve conflicts`).
242The link:project-setup.html#submit_type[submit type] is the method
243Gerrit 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
246link:project-setup.html#content_merge[content merge] setting applies
247if 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
255link:project-setup.html#fast_forward_only[Fast Forward Only]. Using
256this 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
263Choosing link:project-setup.html#merge_if_necessary[Merge If Necessary]
264as 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
284described in the link:project-setup.html#submit_type[Submit Type]
285section.
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
333submittability. Amongst others the list of the modified files can be
334accessed, 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
Edwin Kempin5d6b9f12014-04-24 14:30:07 +0200384in the Gerrit WebUI under `People` > `Create Service User`. For this
385the `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 Kempin34f4f882014-04-22 16:13:18 +0200398[[branch-administration]]
399== Branch Administration
400
401As project owner you can administrate the branches of your project in
402the Gerrit WebUI under `Projects` > `List` > <your project> >
403`Branches`. In the WebUI both link:project-setup.html#branch-creation[
404branch creation] and link:project-setup.html#branch-deletion[branch
405deletion] are allowed for project owners without requiring any
406additional access rights.
407
408By setting `HEAD` on the project you can define its
409link:project-setup.html#default-branch[default branch]. For convenience
410reasons, when the repository is cloned Git creates a local branch for
411this default branch and checks it out.
412
Edwin Kempinef2b6af2014-04-22 11:04:10 +0200413[[notifications]]
414== Email Notifications
415
416With Gerrit individual users control their own email subscriptions. By
417editing the link:user-notify.html#user[watched projects] in the WebUI
418under `Settings` > `Watched Projects` users can decide which events to
419be informed about by email. The change notifications can be filtered by
420link:user-search.html[change search expressions].
421
422This means as a project owner you normally don't need to do anything
423about email notifications, except maybe telling your project team where
424to configure the watches.
425
426Gerrit also supports link:user-notify.html#project[notifications on
427project level] that allow project owners to set up email notifications
428for team mailing lists or groups of users. This configuration is done
429in the `project.config` file in the `refs/meta/config` branch as
430explained in the section about link:user-notify.html#project[project
431level notifications].
432
Edwin Kempin09c49602014-04-22 11:33:00 +0200433[[dashboards]]
434== Dashboards
435
436Gerrit comes with a pre-defined user dashboard that provides a view
437of the changes that are relevant for a user. Users can also define
438their own link:user-dashboards.html[custom dashboards] where the
439dashboard sections can be freely configured. As a project owner you can
440configure such custom dashboards on
441link:user-dashboards.html#project-dashboards[project level]. This way
442you can define a view of the changes that are relevant for your
443project and share this dashboard with all users. The project dashboards
444can be seen in the WebUI under `Projects` > `List` > <your project> >
445`Dashboards`.
446
Edwin Kempin96cdad42014-04-22 13:30:56 +0200447[[issue-tracker-integration]]
448== Issue Tracker Integration
449
450There are several possibilities to integrate issue trackers with
451Gerrit.
452
453- Comment Links
454+
Edwin Kempin8691f5a2014-04-30 09:21:57 +0200455As described in the link:#comment-links[Comment Links] section, comment
Edwin Kempin96cdad42014-04-22 13:30:56 +0200456links can be used to link IDs from commit message footers to issues in
457an issue tracker system.
458
459- Tracking IDs
460+
461Gerrit can be configured to index IDs from commit message footers so
462that the link:user-search.html#tr[tr/bug] search operators can be used
463to query for changes with a certain ID. The
464link:config-gerrit.html#trackingid[configuration of tracking IDs] can
465only be done globally by a Gerrit administrator.
466
467- Issue Tracker System Plugins
468+
469There are Gerrit plugins for a tight integration with
470link:https://gerrit-review.googlesource.com/\#/admin/projects/plugins/its-jira[Jira],
471link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/its-bugzilla[Bugzilla] and
472link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/its-rtc[IBM Rational Team Concert].
473If installed, these plugins can e.g. be used to automatically add links
474to Gerrit changes to the issues in the issue tracker system or to
475automatically close an issue if the corresponding change is merged.
476If installed, project owners may enable/disable the issue tracker
477integration from the Gerrit WebUI under `Projects` > `Lists` >
478<your project> > `General`.
479
480[[comment-links]]
481== Comment Links
482
483Gerrit can linkify strings in commit messages, summary comments and
484inline comments. A string that matches a defined regular expression is
485then displayed as hyperlink to a configured backend system.
486
487So called comment links can be configured globally by a Gerrit
488administrator, but also per project by the project owner. Comment links
489on project level are defined in the `project.config` file in the
490`refs/meta/config` branch of the project as described in the
491documentation of the link:config-gerrit.html#commentlink[commentlink]
492configuration parameter.
493
494Often comment links are used to link an ID in a commit message footer
495to an issue in an issue tracker system. For example, to link the ID
496from the `Bug` footer to Jira the following configuration can be used:
497
498====
499 [commentlink "myjira"]
500 match = ([Bb][Uu][Gg]:\\s+)(\\S+)
501 link = https://myjira/browse/$2
502====
503
Edwin Kempin5d803952014-04-24 14:19:42 +0200504[[reviewers]]
505== Reviewers
506
507Normally it is not needed to explicitly assign reviewers to every
508change since the project members either link:user-notify.html#user[
509watch the project] and get notified by email or regularly check the
510list of open changes in the Gerrit WebUI. The project members then
511pick the changes themselves that are interesting to them for review.
512
513If authors of changes want to have a review by a particular person
514(e.g. someone who is known to be expert in the touched code area, or a
515stakeholder for the implemented feature), they can request the review
516by adding this person in the Gerrit WebUI as a reviewer on the change.
517Gerrit will then notify this person by email about the review request.
518
519With the link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/reviewers[
520reviewers] plugin it is possible to configure default reviewers who
521will be automatically added to each change. The default reviewers can
522be configured in the Gerrit WebUI under `Projects` > `List` >
523<your project> > `General` in the `reviewers Plugin` section.
524
525The link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/reviewers-by-blame[
526reviewers-by-blame] plugin can automatically add reviewers to changes
527based on the link:https://www.kernel.org/pub/software/scm/git/docs/git-blame.html[
528git blame] computation on the changed files. This means that the plugin
529will add those users as reviewer that authored most of the lines
530touched by the change, since these users should be familiar with the
531code and can most likely review the change. How many reviewers the
532plugin will add to a change at most can be configured in the Gerrit
533WebUI under `Projects` > `List` > <your project> > `General` in the
534`reviewers-by-blame Plugin` section.
535
Edwin Kempine622b792014-04-23 13:06:57 +0200536[[download-commands]]
537== Download Commands
538
539On the change screen in the `Downloads` drop-down panel Gerrit offers
540commands for downloading the currently viewed patch set.
541
542The download commands are implemented by Gerrit plugins. This means
543that the available download commands depend on the installed Gerrit
544plugins:
545
546- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/download-commands[
547 download-commands] plugin:
548+
549The `download-commands` plugin provides the default download commands
550(`Checkout`, `Cherry Pick`, `Format Patch` and `Pull`).
551+
552Gerrit administrators may configure which of the commands are shown on
553the change screen.
554
555- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/egit[
556 egit] plugin:
557+
558The `egit` plugin provides the change ref as a download command, which is
559needed for downloading a change from within
560link:https://www.eclipse.org/egit/[EGit].
561
562- link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/project-download-commands[
563 project-download-commands] plugin:
564+
565The `project-download-commands` plugin enables project owners to
566configure project-specific download commands. For example, a
567project-specific download command may update submodules, trigger a
568build, execute the tests or even do a deployment.
569+
570The project-specific download commands must be configured in the
571`project.config` file in the `refs/meta/config` branch of the project:
572+
573====
574 [plugin "project-download-commands"]
575 Build = git fetch ${url} ${ref} && git checkout FETCH_HEAD && buck build ${project}
576 Update = git fetch ${url} ${ref} && git checkout FETCH_HEAD && git submodule update
577====
578+
579Project-specific download commands that are defined on a parent project
580are inherited by the child projects. A child project can overwrite an
581inherited download command, or remove it by assigning no value to it.
Edwin Kempin96cdad42014-04-22 13:30:56 +0200582
Edwin Kempin37e6d962014-04-24 13:32:36 +0200583[[theme]]
584== Theme
585
586Gerrit supports project-specific themes for customizing the appearance
587of the change screen and the diff screens. It is possible to define an
588HTML header and footer and to adapt Gerrit's CSS. Details about themes
589are explained in the link:config-themes.html[Themes] section.
590
591Project-specific themes can only be installed by Gerrit administrators
592since the theme files must be copied into the Gerrit installation
593folder.
594
Edwin Kempin15199792014-04-23 16:22:05 +0200595[[tool-integration]]
596== Integration with other tools
597
598Gerrit provides many possibilities for the integration with other
599tools:
600
601- Stream Events:
602+
603The link:cmd-stream-events.html[stream-events] SSH command allows to
604listen to Gerrit link:cmd-stream-events.html#events[events]. Other
605tools can use this to react on actions done in Gerrit.
606+
607The link:access-control.html#capability_streamEvents[Stream Events]
608global capability is required for using the `stream-events` command.
609
610- REST API:
611+
612Gerrit provides a rich link:rest-api.html[REST API] that other tools
613can use to query information from Gerrit and and to trigger actions in
614Gerrit.
615
616- Gerrit Plugins:
617+
618The Gerrit functionality can be extended by plugins and there are many
619extension points, e.g. plugins can
620+
621** link:dev-plugins.html#top-menu-extensions[add new menu entries]
622** link:dev-plugins.html#ui_extension[extend existing screens] and
623 link:dev-plugins.html#screen[add new screens]
624** link:config-validation.html[do validation], e.g. of new commits
625** add new REST endpoints and link:dev-plugins.html#ssh[SSH commands]
626
627+
628How to develop a Gerrit plugin is described in the link:dev-plugins.html[
629Plugin Development] section.
630
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200631[[prject-lifecycle]]
632== Project Lifecycle
633
634[[project-creation]]
635=== Project Creation
636
637New projects can be created in the Gerrit WebUI under `Projects` >
638`Create Project`. The `Create Project` menu entry is only available if
639you have the link:access-control.html#capability_createProject[
640Create Project] global capability assigned.
641
642Projects can also be created via REST or SSH as described in the
643link:project-setup.html#project-creation[Project Setup] section.
644
645Creating the project with an initial empty commit is generally
646recommended because some tools have issues with cloning repositories
647that are completely empty. However, if you plan to link:#import-history[
648import an existing history] into the new project, it is better to
649create the project without an initial empty commit.
650
651[[import-history]]
652=== Import Existing History
653
654If you have an existing history you can import it into a Gerrit
655project. To do this you need to have a local Git repository that
656contains this history. If your existing codebase is in another VCS you
657must migrate it to Git first. For Subversion you can use the
658link:http://git-scm.com/book/en/Git-and-Other-Systems-Git-and-Subversion[
659git svn] command as described in the
660link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Subversion[
661Subversion migration guide]. An importer for Perforce is available in
662the `contrib` section of the Git source code; how to use
663link:http://git-scm.com/docs/git-p4[git p4] to do the import from
664Perforce is described in the
665link:http://git-scm.com/book/en/Git-and-Other-Systems-Migrating-to-Git#Perforce[
666Perforce migration guide].
667
668To import an existing history into a Gerrit project you bypass code
669review and push it directly to `refs/heads/<branch>`. For this you must
670have the corresponding link:access-control.html#category_push_direct[
671Push] access right assigned. If the destination branch in the Gerrit
672repository already contains a history (e.g. an initial empty commit),
673you can overwrite it by doing a force push. In this case force push
674must be allowed in the access controls of the project.
675
676Some Gerrit servers may disallow forging committers by blocking the
677link:access-control.html#category_forge_committer[Forge Committer]
678access right globally. In this case you must use the
679link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
680git filter-branch] command to rewrite the committer information for all
681commits (the author information that records who was writing the code
682stays intact; signed tags will lose their signature):
683
684====
685 $ git filter-branch --tag-name-filter cat --env-filter 'GIT_COMMITTER_NAME="John Doe"; GIT_COMMITTER_EMAIL="john.doe@example.com";' -- --all
686====
687
688If a link:config-gerrit.html#receive.maxObjectSizeLimit[max object size
689limit] is configured on the server you may need to remove large objects
690from the history before you are able to push. To find large objects in
691the history of your project you can use the
692link:https://gerrit.googlesource.com/gerrit/+/master/contrib/reposize.sh[
693reposize.sh] script from Gerrit's `contrib` folder. You can then use the
694link:https://www.kernel.org/pub/software/scm/git/docs/git-filter-branch.html[
695git filter-branch] command to remove the large objects from the history
696of all branches:
697
698====
699 $ git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch path/to/large-file.jar' -- --all
700====
701
702Since this command rewrites all commits in the repository it's a good
703idea to create a fresh clone from this rewritten repository before
704pushing to Gerrit, this will ensure that the original objects which
705have been rewritten are removed.
706
707[[project-deletion]]
708=== Project Deletion
709
710Gerrit core does not support the deletion of projects.
711
712If the link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/delete-project[
713delete-project] plugin is installed, projects can be deleted from the
714Gerrit WebUI under `Projects` > `List` > <project> > `General` by
715clicking on the `Delete` command under `Project Commands`. The `Delete`
Edwin Kempin56bac942014-04-24 14:25:42 +0200716command is only available if you have the `Delete Projects` global
717capability assigned, or if you own the project and you have the
718`Delete Own Projects` global capability assigned. If neither of these
719capabilities is granted, you need to contact a Gerrit administrator to
720request the deletion of your project.
Edwin Kempinf2b47e22014-04-24 13:00:28 +0200721
722Instead of deleting a project you may set the
723link:project-setup.html#project-state[project state] to `ReadOnly` or
724`Hidden`.
725
726[[project-rename]]
727=== Project Rename
728
729Gerrit core does not support the renaming of projects.
730
731As workaround you may
732
733. link:#project-creation[create a new project] with the new name
734. link:#import-history[import the history of the old project]
735. link:#project-deletion[delete the old project]
736
Edwin Kempin4bf01962014-04-16 16:47:10 +0200737GERRIT
738------
739Part of link:index.html[Gerrit Code Review]
740
741SEARCHBOX
742---------