blob: 0183534e720e28fa98aa3e510145a5fd3021f161 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Gerrit Code Review - Project Configuration File Format
Fredrik Luthandera3cf3542012-07-04 16:55:35 -07002
3This page explains the storage format of Gerrit's project configuration
4and access control models.
5
6The web UI access control panel is a front end for human-readable
7configuration files under the +refs/meta/config+ namespace in the
8affected project. Direct manipulation of these files is mainly
9relevant in an automation scenario of the access controls.
10
11
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080012== The +refs/meta/config+ namespace
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070013
14The namespace contains three different files that play different
15roles in the permission model. With read permission to that reference,
16it is possible to fetch the +refs/meta/config+ reference to a local
17repository. A nice side effect is that you can also upload changes
18to project permissions and review them just like with regular code
19changes. The preview changes option is also provided on the UI. Please note
20that you will have to configure push rights for the +refs/meta/config+ name
21space if you'd like to use the possibility to automate permission updates.
22
Björn Pedersend169b6d2016-08-31 17:56:45 +020023== Property inheritance
24
25If a property is set to INHERIT, then the value from the parent project is
26used. If the property is not set in any parent project, the default value is
27FALSE.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070028
29[[file-project_config]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080030== The file +project.config+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070031
32The +project.config+ file contains the link between groups and their
33permitted actions on reference patterns in this project and any projects
34that inherit its permissions.
35
36The format in this file corresponds to the Git config file format, so
37if you want to automate your permissions it is a good idea to use the
38+git config+ command when writing to the file. This way you know you
39don't accidentally break the format of the file.
40
41Here follows a +git config+ command example:
42
43----
44$ git config -f project.config project.description "Rights inherited by all other projects"
45----
46
47Below you will find an example of the +project.config+ file format:
48
49----
50[project]
51 description = Rights inherited by all other projects
52[access "refs/*"]
53 read = group Administrators
David Myllykangasb3ccec62015-01-21 15:41:13 +010054[access "refs/heads/*"]
55 label-Your-Label-Here = -1..+1 group Administrators
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070056[capability]
57 administrateServer = group Administrators
58[receive]
59 requireContributorAgreement = false
David Myllykangasb3ccec62015-01-21 15:41:13 +010060[label "Your-Label-Here"]
61 function = MaxWithBlock
62 value = -1 Your -1 Description
63 value = 0 Your No score Description
64 value = +1 Your +1 Description
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070065----
66
67As you can see, there are several sections.
68
69The link:#project-section[+project+ section] appears once per project.
70
71The link:#access-section[+access+ section] appears once per reference pattern,
Jonathan Nieder5758f182015-03-30 11:28:55 -070072such as `+refs/*+` or `+refs/heads/*+`. Only one access section per pattern is
David Pursehouseacb5c1d2016-08-29 10:29:57 +090073allowed.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070074
75The link:#receive-section[+receive+ section] appears once per project.
76
77The link:#submit-section[+submit+ section] appears once per project.
78
79The link:#capability-section[+capability+] section only appears once, and only
80in the +All-Projects+ repository. It controls core features that are configured
David Pursehouseacb5c1d2016-08-29 10:29:57 +090081on a global level.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070082
David Myllykangasb3ccec62015-01-21 15:41:13 +010083The link:#label-section[+label+] section can appear multiple times. You can
84also redefine the text and behavior of the built in label types `Code-Review`
85and `Verified`.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070086
Edwin Kempin424f96c62016-10-13 09:00:55 +020087Optionally a +commentlink+ section can be added to define project-specific
88comment links. The +commentlink+ section has the same format as the
89link:config-gerrit.html#commentlink[+commentlink+ section in gerrit.config]
90which is used to define global comment links.
91
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070092[[project-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080093=== Project section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070094
95The project section includes configuration of project settings.
96
97These are the keys:
98
99- Description
100
101
102[[receive-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800103=== Receive section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700104
105The receive section includes configuration of project-specific
106receive settings:
107
108[[receive.requireContributorAgreement]]receive.requireContributorAgreement::
109+
110Controls whether or not a user must complete a contributor agreement before
111they can upload changes. Default is `INHERIT`. If `All-Project` enables this
112option then the dependent project must set it to false if users are not
113required to sign a contributor agreement prior to submitting changes for that
114specific project. To use that feature the global option in `gerrit.config`
115must be enabled:
116link:config-gerrit.html#auth.contributorAgreements[auth.contributorAgreements].
117
118[[receive.requireSignedOffBy]]receive.requireSignedOffBy::
119+
120Sign-off can be a requirement for some projects (for example Linux kernel uses
121it). Sign-off is a line at the end of the commit message which certifies who
122is the author of the commit. Its main purpose is to improve tracking of who
123did what, especially with patches. Default is `INHERIT`, which means that this
124property is inherited from the parent project.
125
126[[receive.requireChangeId]]receive.requireChangeId::
127+
128Controls whether or not the Change-Id must be included in the commit message
129in the last paragraph. Default is `INHERIT`, which means that this property
130is inherited from the parent project.
131
132[[receive.maxObjectSizeLimit]]receive.maxObjectSizeLimit::
133+
134Maximum allowed Git object size that receive-pack will accept. If an object
135is larger than the given size the pack-parsing will abort and the push
136operation will fail. If set to zero then there is no limit.
137+
138Project owners can use this setting to prevent developers from pushing
139objects which are too large to Gerrit. This setting can also be set it
140`gerrit.config` globally link:config-gerrit.html#receive.maxObjectSizeLimit[
141receive.maxObjectSizeLimit].
142+
143The project specific setting in `project.config` is only honored when it
144further reduces the global limit.
145+
146Default is zero.
147+
148Common unit suffixes of k, m, or g are supported.
149
Rob Ward2cf12952014-01-26 20:38:12 +0000150[[receive.checkReceivedObjects]]receive.checkReceivedObjects::
151+
152Controls whether or not the JGit functionality for checking received objects
153is enabled.
154+
155By default Gerrit checks the validity of git objects. Setting this variable to
156false should not be used unless a project with history containing invalid
157objects needs to be pushed into a Gerrit repository.
158+
159This functionality is provided as some other git implementations have allowed
160bad history to be written into git repositories. If these repositories need pushing
161up to Gerrit then the JGit checks need to be disabled.
162+
163The default value for this is true, false disables the checks.
164
Dave Borowitz5170e0f2015-06-18 21:05:29 -0400165[[receive.enableSignedPush]]receive.enableSignedPush::
166+
167Controls whether server-side signed push validation is enabled on the
168project. Only has an effect if signed push validation is enabled on the
169server; see the link:config-gerrit.html#receive.enableSignedPush[global
170configuration] for details.
171+
172Default is `INHERIT`, which means that this property is inherited from
173the parent project.
174
Dave Borowitz0543c732015-10-20 10:35:26 -0400175[[receive.requireSignedPush]]receive.requireSignedPush::
176+
177Controls whether server-side signed push validation is required on the
178project. Only has an effect if signed push validation is enabled on the
179server, and link:#receive.enableSignedPush is set on the project. See
180the link:config-gerrit.html#receive.enableSignedPush[global
181configuration] for details.
182+
183Default is `INHERIT`, which means that this property is inherited from
184the parent project.
185
Saša Živkov225b7a72015-11-17 17:37:43 +0100186[[receive.rejectImplicitMerges]]receive.rejectImplicitMerges::
187+
188Controls whether a check for implicit merges will be performed when changes are
189pushed for review. An implicit merge is a case where merging an open change
190would implicitly merge another branch into the target branch. Typically, this
191happens when a change is done on master and, by mistake, pushed to a stable branch
192for review. When submitting such change, master would be implicitly merged into
193stable without anyone noticing that. When this option is set to 'true' Gerrit
194will reject the push if an implicit merge is detected.
195+
196This check is only done for non-merge commits, merge commits are not subject of
197the implicit merge check.
198+
199Default is `INHERIT`, which means that this property is inherited from
200the parent project.
201
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700202[[submit-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800203=== Submit section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700204
205The submit section includes configuration of project-specific
206submit settings:
207
208- 'mergeContent': Defines whether to automatically merge changes. Valid values
209are 'true', 'false', or 'INHERIT'. Default is 'INHERIT'.
210
Stefan Lay08ba4732014-05-05 16:36:12 +0200211- 'action': defines the link:project-configuration.html#submit_type[submit type]. Valid
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700212values are 'fast forward only', 'merge if necessary', 'rebase if necessary',
213'merge always' and 'cherry pick'. The default is 'merge if necessary'.
214
Patrick Hiesel5a316352017-06-22 15:38:06 +0200215- 'matchAuthorToCommitterDate': Defines whether to the author date will be changed to match the
216submitter date upon submit, so that git log shows when the change was submitted instead of when the
217author last committed. Valid values are 'true', 'false', or 'INHERIT'. The default is 'INHERIT'.
218This option only takes effect in submit strategies which already modify the commit, i.e.
219Cherry Pick, Rebase Always, and (perhaps) Rebase If Necessary.
220
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700221Merge strategy
222
223
224[[access-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800225=== Access section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700226
227Each +access+ section includes a reference and access rights connected
228to groups. Each group listed must exist in the link:#file-groups[+groups+ file].
229
230Please refer to the
231link:access-control.html#access_categories[Access Categories]
232documentation for a full list of available access rights.
233
234
Shawn Pearce9cfcebd2014-04-25 16:41:12 -0700235[[mimetype-section]]
236=== MIME Types section
237
238The +mimetype+ section may be configured to force the web code
239reviewer to return certain MIME types by file path. MIME types
240may be used to activate syntax highlighting.
241
242----
243[mimetype "text/x-c"]
244 path = *.pkt
245[mimetype "text/x-java"]
246 path = api/current.txt
247----
248
249
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700250[[capability-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800251=== Capability section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700252
253The +capability+ section only appears once, and only in the +All-Projects+
254repository. It controls Gerrit administration capabilities that are configured
255on a global level.
256
257Please refer to the
258link:access-control.html#global_capabilities[Global Capabilities]
259documentation for a full list of available capabilities.
260
David Myllykangasb3ccec62015-01-21 15:41:13 +0100261[[label-section]]
262=== Label section
263
264Please refer to link:config-labels.html#label_custom[Custom Labels] documentation.
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700265
Saša Živkov944b8382014-05-08 14:02:15 +0200266[[branchOrder-section]]
267=== branchOrder section
268
269Defines a branch ordering which is used for backporting of changes.
270Backporting will be offered for a change (in the Gerrit UI) for all
271more stable branches where the change can merge cleanly.
272
273[[branchOrder.branch]]branchOrder.branch::
274+
275A branch name, typically multiple values will be defined. The order of branch
276names in this section defines the branch order. The topmost is considered to be
277the least stable branch (typically the master branch) and the last one the
278most stable (typically the last maintained release branch).
279
280Example:
281
282----
283[branchOrder]
284 branch = master
285 branch = stable-2.9
286 branch = stable-2.8
287 branch = stable-2.7
288----
289
290The `branchOrder` section is inheritable. This is useful when multiple or all
291projects follow the same branch rules. A `branchOrder` section in a child
292project completely overrides any `branchOrder` section from a parent i.e. there
293is no merging of `branchOrder` sections. A present but empty `branchOrder`
294section removes all inherited branch order.
295
296Branches not listed in this section will not be included in the mergeability
297check. If the `branchOrder` section is not defined then the mergeability of a
298change into other branches will not be done.
299
Patrick Hiesel6db5afd2017-03-21 09:40:03 +0100300[[reviewer-section]]
301=== reviewer section
302
303Defines config options to adjust a project's reviewer workflow such as enabling
304reviewers and CCs by email.
305
306[[reviewer.enableByEmail]]reviewer.enableByEmail::
307+
308A boolean indicating if reviewers and CCs that do not currently have a Gerrit
309account can be added to a change by providing their email address.
310
Patrick Hiesel502b26c2017-03-29 14:19:23 +0200311Default is `INHERIT`, which means that this property is inherited from
312the parent project. If the property is not set in any parent project, the
313default value is `FALSE`.
Saša Živkov944b8382014-05-08 14:02:15 +0200314
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700315[[file-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800316== The file +groups+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700317
318Each group in this list is linked with its UUID so that renaming of
319groups is possible without having to rewrite every +groups+ file
320in every repository where it's used.
321
322This is what the default groups file for +All-Projects.git+ looks like:
323
324----
325# UUID Group Name
326#
3273d6da7dc4e99e6f6e5b5196e21b6f504fc530bba Administrators
328global:Anonymous-Users Anonymous Users
Khai Do5aaeee32014-09-05 10:14:32 -0700329global:Change-Owner Change Owner
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700330global:Project-Owners Project Owners
331global:Registered-Users Registered Users
332----
333
334This file can't be written to by the +git config+ command.
335
336In order to reference a group in +project.config+, it must be listed in
337the +groups+ file. When editing permissions through the web UI this
338file is maintained automatically, but when pushing updates to
339+refs/meta/config+ this must be dealt with by hand. Gerrit will refuse
340+project.config+ files that refer to groups not listed in +groups+.
341
342The UUID of a group can be found on the General tab of the group's page
343in the web UI or via the +-v+ option to
344link:cmd-ls-groups.html[the +ls-groups+ SSH command].
345
346
347[[file-rules_pl]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800348== The file +rules.pl+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700349
350The +rules.pl+ files allows you to replace or amend the default Prolog
351rules that control e.g. what conditions need to be fulfilled for a
352change to be submittable. This file content should be
353interpretable by the 'Prolog Cafe' interpreter.
354
355You can read more about the +rules.pl+ file and the prolog rules on
356link:prolog-cookbook.html[the Prolog cookbook page].
357
358GERRIT
359------
360Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700361
362SEARCHBOX
363---------