blob: 63d8d6c703207e3a0f20b73cea56b40245cf2f12 [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,
207but you can also get automatic verifications from a build server
208before changes are merged. In addition you can benefit from Gerrit's
209merge strategies that can automatically merge/rebase commits on server
210side if necessary. You can control the merge strategy by configuring
211the link:project-setup.html#submit_type[submit type] on the project.
212If you bypass code review you always need to merge/rebase manually if
213the tip of the destination branch has moved. Please keep this in mind
214if you choose to not work with code review because you think it's
215easier to avoid the additional complexity of the review workflow; it
216might actually not be easier.
217
218You may also enable link:user-upload.html#auto_merge[auto-merge on
219push] to benefit from the automatic merge/rebase on server side while
220pushing directly into the repository.
221
222GERRIT
223------
224Part of link:index.html[Gerrit Code Review]
225
226SEARCHBOX
227---------