blob: 64fa9c456804d9fc571f5f26c5c3b255af0308ab [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
23
24[[file-project_config]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080025== The file +project.config+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070026
27The +project.config+ file contains the link between groups and their
28permitted actions on reference patterns in this project and any projects
29that inherit its permissions.
30
31The format in this file corresponds to the Git config file format, so
32if you want to automate your permissions it is a good idea to use the
33+git config+ command when writing to the file. This way you know you
34don't accidentally break the format of the file.
35
36Here follows a +git config+ command example:
37
38----
39$ git config -f project.config project.description "Rights inherited by all other projects"
40----
41
42Below you will find an example of the +project.config+ file format:
43
44----
45[project]
46 description = Rights inherited by all other projects
47[access "refs/*"]
48 read = group Administrators
49[capability]
50 administrateServer = group Administrators
51[receive]
52 requireContributorAgreement = false
53----
54
55As you can see, there are several sections.
56
57The link:#project-section[+project+ section] appears once per project.
58
59The link:#access-section[+access+ section] appears once per reference pattern,
60such as `refs/*` or `refs/heads/*`. Only one access section per pattern is
61allowed. You will find examples of keys and values in each category section
62<<access_category,below>>.
63
64The link:#receive-section[+receive+ section] appears once per project.
65
66The link:#submit-section[+submit+ section] appears once per project.
67
68The link:#capability-section[+capability+] section only appears once, and only
69in the +All-Projects+ repository. It controls core features that are configured
70on a global level. You can find examples of these
71<<capability_category,below>>.
72
73
74[[project-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080075=== Project section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070076
77The project section includes configuration of project settings.
78
79These are the keys:
80
81- Description
82
83
84[[receive-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080085=== Receive section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -070086
87The receive section includes configuration of project-specific
88receive settings:
89
90[[receive.requireContributorAgreement]]receive.requireContributorAgreement::
91+
92Controls whether or not a user must complete a contributor agreement before
93they can upload changes. Default is `INHERIT`. If `All-Project` enables this
94option then the dependent project must set it to false if users are not
95required to sign a contributor agreement prior to submitting changes for that
96specific project. To use that feature the global option in `gerrit.config`
97must be enabled:
98link:config-gerrit.html#auth.contributorAgreements[auth.contributorAgreements].
99
100[[receive.requireSignedOffBy]]receive.requireSignedOffBy::
101+
102Sign-off can be a requirement for some projects (for example Linux kernel uses
103it). Sign-off is a line at the end of the commit message which certifies who
104is the author of the commit. Its main purpose is to improve tracking of who
105did what, especially with patches. Default is `INHERIT`, which means that this
106property is inherited from the parent project.
107
108[[receive.requireChangeId]]receive.requireChangeId::
109+
110Controls whether or not the Change-Id must be included in the commit message
111in the last paragraph. Default is `INHERIT`, which means that this property
112is inherited from the parent project.
113
114[[receive.maxObjectSizeLimit]]receive.maxObjectSizeLimit::
115+
116Maximum allowed Git object size that receive-pack will accept. If an object
117is larger than the given size the pack-parsing will abort and the push
118operation will fail. If set to zero then there is no limit.
119+
120Project owners can use this setting to prevent developers from pushing
121objects which are too large to Gerrit. This setting can also be set it
122`gerrit.config` globally link:config-gerrit.html#receive.maxObjectSizeLimit[
123receive.maxObjectSizeLimit].
124+
125The project specific setting in `project.config` is only honored when it
126further reduces the global limit.
127+
128Default is zero.
129+
130Common unit suffixes of k, m, or g are supported.
131
Rob Ward2cf12952014-01-26 20:38:12 +0000132[[receive.checkReceivedObjects]]receive.checkReceivedObjects::
133+
134Controls whether or not the JGit functionality for checking received objects
135is enabled.
136+
137By default Gerrit checks the validity of git objects. Setting this variable to
138false should not be used unless a project with history containing invalid
139objects needs to be pushed into a Gerrit repository.
140+
141This functionality is provided as some other git implementations have allowed
142bad history to be written into git repositories. If these repositories need pushing
143up to Gerrit then the JGit checks need to be disabled.
144+
145The default value for this is true, false disables the checks.
146
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700147[[submit-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800148=== Submit section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700149
150The submit section includes configuration of project-specific
151submit settings:
152
153- 'mergeContent': Defines whether to automatically merge changes. Valid values
154are 'true', 'false', or 'INHERIT'. Default is 'INHERIT'.
155
156- 'action': defines the link:project-setup.html#submit_type[submit type]. Valid
157values are 'fast forward only', 'merge if necessary', 'rebase if necessary',
158'merge always' and 'cherry pick'. The default is 'merge if necessary'.
159
160Merge strategy
161
162
163[[access-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800164=== Access section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700165
166Each +access+ section includes a reference and access rights connected
167to groups. Each group listed must exist in the link:#file-groups[+groups+ file].
168
169Please refer to the
170link:access-control.html#access_categories[Access Categories]
171documentation for a full list of available access rights.
172
173
Shawn Pearce9cfcebd2014-04-25 16:41:12 -0700174[[mimetype-section]]
175=== MIME Types section
176
177The +mimetype+ section may be configured to force the web code
178reviewer to return certain MIME types by file path. MIME types
179may be used to activate syntax highlighting.
180
181----
182[mimetype "text/x-c"]
183 path = *.pkt
184[mimetype "text/x-java"]
185 path = api/current.txt
186----
187
188
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700189[[capability-section]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800190=== Capability section
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700191
192The +capability+ section only appears once, and only in the +All-Projects+
193repository. It controls Gerrit administration capabilities that are configured
194on a global level.
195
196Please refer to the
197link:access-control.html#global_capabilities[Global Capabilities]
198documentation for a full list of available capabilities.
199
200
201[[file-groups]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800202== The file +groups+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700203
204Each group in this list is linked with its UUID so that renaming of
205groups is possible without having to rewrite every +groups+ file
206in every repository where it's used.
207
208This is what the default groups file for +All-Projects.git+ looks like:
209
210----
211# UUID Group Name
212#
2133d6da7dc4e99e6f6e5b5196e21b6f504fc530bba Administrators
214global:Anonymous-Users Anonymous Users
215global:Project-Owners Project Owners
216global:Registered-Users Registered Users
217----
218
219This file can't be written to by the +git config+ command.
220
221In order to reference a group in +project.config+, it must be listed in
222the +groups+ file. When editing permissions through the web UI this
223file is maintained automatically, but when pushing updates to
224+refs/meta/config+ this must be dealt with by hand. Gerrit will refuse
225+project.config+ files that refer to groups not listed in +groups+.
226
227The UUID of a group can be found on the General tab of the group's page
228in the web UI or via the +-v+ option to
229link:cmd-ls-groups.html[the +ls-groups+ SSH command].
230
231
232[[file-rules_pl]]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800233== The file +rules.pl+
Fredrik Luthandera3cf3542012-07-04 16:55:35 -0700234
235The +rules.pl+ files allows you to replace or amend the default Prolog
236rules that control e.g. what conditions need to be fulfilled for a
237change to be submittable. This file content should be
238interpretable by the 'Prolog Cafe' interpreter.
239
240You can read more about the +rules.pl+ file and the prolog rules on
241link:prolog-cookbook.html[the Prolog cookbook page].
242
243GERRIT
244------
245Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700246
247SEARCHBOX
248---------