Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 1 | = Gerrit Code Review - Project Configuration File Format |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 2 | |
| 3 | This page explains the storage format of Gerrit's project configuration |
| 4 | and access control models. |
| 5 | |
| 6 | The web UI access control panel is a front end for human-readable |
| 7 | configuration files under the +refs/meta/config+ namespace in the |
| 8 | affected project. Direct manipulation of these files is mainly |
| 9 | relevant in an automation scenario of the access controls. |
| 10 | |
| 11 | |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 12 | == The +refs/meta/config+ namespace |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 13 | |
| 14 | The namespace contains three different files that play different |
| 15 | roles in the permission model. With read permission to that reference, |
| 16 | it is possible to fetch the +refs/meta/config+ reference to a local |
| 17 | repository. A nice side effect is that you can also upload changes |
| 18 | to project permissions and review them just like with regular code |
| 19 | changes. The preview changes option is also provided on the UI. Please note |
| 20 | that you will have to configure push rights for the +refs/meta/config+ name |
| 21 | space if you'd like to use the possibility to automate permission updates. |
| 22 | |
Björn Pedersen | d169b6d | 2016-08-31 17:56:45 +0200 | [diff] [blame] | 23 | == Property inheritance |
| 24 | |
| 25 | If a property is set to INHERIT, then the value from the parent project is |
| 26 | used. If the property is not set in any parent project, the default value is |
| 27 | FALSE. |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 28 | |
| 29 | [[file-project_config]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 30 | == The file +project.config+ |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 31 | |
| 32 | The +project.config+ file contains the link between groups and their |
| 33 | permitted actions on reference patterns in this project and any projects |
| 34 | that inherit its permissions. |
| 35 | |
| 36 | The format in this file corresponds to the Git config file format, so |
| 37 | if 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 |
| 39 | don't accidentally break the format of the file. |
| 40 | |
| 41 | Here follows a +git config+ command example: |
| 42 | |
| 43 | ---- |
| 44 | $ git config -f project.config project.description "Rights inherited by all other projects" |
| 45 | ---- |
| 46 | |
| 47 | Below 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 Myllykangas | b3ccec6 | 2015-01-21 15:41:13 +0100 | [diff] [blame] | 54 | [access "refs/heads/*"] |
| 55 | label-Your-Label-Here = -1..+1 group Administrators |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 56 | [capability] |
| 57 | administrateServer = group Administrators |
| 58 | [receive] |
| 59 | requireContributorAgreement = false |
David Myllykangas | b3ccec6 | 2015-01-21 15:41:13 +0100 | [diff] [blame] | 60 | [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 Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 65 | ---- |
| 66 | |
| 67 | As you can see, there are several sections. |
| 68 | |
| 69 | The link:#project-section[+project+ section] appears once per project. |
| 70 | |
| 71 | The link:#access-section[+access+ section] appears once per reference pattern, |
Jonathan Nieder | 5758f18 | 2015-03-30 11:28:55 -0700 | [diff] [blame] | 72 | such as `+refs/*+` or `+refs/heads/*+`. Only one access section per pattern is |
David Pursehouse | acb5c1d | 2016-08-29 10:29:57 +0900 | [diff] [blame] | 73 | allowed. |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 74 | |
| 75 | The link:#receive-section[+receive+ section] appears once per project. |
| 76 | |
| 77 | The link:#submit-section[+submit+ section] appears once per project. |
| 78 | |
| 79 | The link:#capability-section[+capability+] section only appears once, and only |
| 80 | in the +All-Projects+ repository. It controls core features that are configured |
David Pursehouse | acb5c1d | 2016-08-29 10:29:57 +0900 | [diff] [blame] | 81 | on a global level. |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 82 | |
David Myllykangas | b3ccec6 | 2015-01-21 15:41:13 +0100 | [diff] [blame] | 83 | The link:#label-section[+label+] section can appear multiple times. You can |
| 84 | also redefine the text and behavior of the built in label types `Code-Review` |
| 85 | and `Verified`. |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 86 | |
Edwin Kempin | 424f96c6 | 2016-10-13 09:00:55 +0200 | [diff] [blame] | 87 | Optionally a +commentlink+ section can be added to define project-specific |
| 88 | comment links. The +commentlink+ section has the same format as the |
| 89 | link:config-gerrit.html#commentlink[+commentlink+ section in gerrit.config] |
| 90 | which is used to define global comment links. |
| 91 | |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 92 | [[project-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 93 | === Project section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 94 | |
| 95 | The project section includes configuration of project settings. |
| 96 | |
| 97 | These are the keys: |
| 98 | |
| 99 | - Description |
| 100 | |
| 101 | |
| 102 | [[receive-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 103 | === Receive section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 104 | |
| 105 | The receive section includes configuration of project-specific |
| 106 | receive settings: |
| 107 | |
| 108 | [[receive.requireContributorAgreement]]receive.requireContributorAgreement:: |
| 109 | + |
| 110 | Controls whether or not a user must complete a contributor agreement before |
| 111 | they can upload changes. Default is `INHERIT`. If `All-Project` enables this |
| 112 | option then the dependent project must set it to false if users are not |
| 113 | required to sign a contributor agreement prior to submitting changes for that |
| 114 | specific project. To use that feature the global option in `gerrit.config` |
| 115 | must be enabled: |
| 116 | link:config-gerrit.html#auth.contributorAgreements[auth.contributorAgreements]. |
| 117 | |
| 118 | [[receive.requireSignedOffBy]]receive.requireSignedOffBy:: |
| 119 | + |
| 120 | Sign-off can be a requirement for some projects (for example Linux kernel uses |
| 121 | it). Sign-off is a line at the end of the commit message which certifies who |
| 122 | is the author of the commit. Its main purpose is to improve tracking of who |
| 123 | did what, especially with patches. Default is `INHERIT`, which means that this |
| 124 | property is inherited from the parent project. |
| 125 | |
| 126 | [[receive.requireChangeId]]receive.requireChangeId:: |
| 127 | + |
| 128 | Controls whether or not the Change-Id must be included in the commit message |
| 129 | in the last paragraph. Default is `INHERIT`, which means that this property |
| 130 | is inherited from the parent project. |
| 131 | |
| 132 | [[receive.maxObjectSizeLimit]]receive.maxObjectSizeLimit:: |
| 133 | + |
| 134 | Maximum allowed Git object size that receive-pack will accept. If an object |
| 135 | is larger than the given size the pack-parsing will abort and the push |
| 136 | operation will fail. If set to zero then there is no limit. |
| 137 | + |
| 138 | Project owners can use this setting to prevent developers from pushing |
| 139 | objects which are too large to Gerrit. This setting can also be set it |
| 140 | `gerrit.config` globally link:config-gerrit.html#receive.maxObjectSizeLimit[ |
| 141 | receive.maxObjectSizeLimit]. |
| 142 | + |
| 143 | The project specific setting in `project.config` is only honored when it |
| 144 | further reduces the global limit. |
| 145 | + |
| 146 | Default is zero. |
| 147 | + |
| 148 | Common unit suffixes of k, m, or g are supported. |
| 149 | |
Rob Ward | 2cf1295 | 2014-01-26 20:38:12 +0000 | [diff] [blame] | 150 | [[receive.checkReceivedObjects]]receive.checkReceivedObjects:: |
| 151 | + |
| 152 | Controls whether or not the JGit functionality for checking received objects |
| 153 | is enabled. |
| 154 | + |
| 155 | By default Gerrit checks the validity of git objects. Setting this variable to |
| 156 | false should not be used unless a project with history containing invalid |
| 157 | objects needs to be pushed into a Gerrit repository. |
| 158 | + |
| 159 | This functionality is provided as some other git implementations have allowed |
| 160 | bad history to be written into git repositories. If these repositories need pushing |
| 161 | up to Gerrit then the JGit checks need to be disabled. |
| 162 | + |
| 163 | The default value for this is true, false disables the checks. |
| 164 | |
Dave Borowitz | 5170e0f | 2015-06-18 21:05:29 -0400 | [diff] [blame] | 165 | [[receive.enableSignedPush]]receive.enableSignedPush:: |
| 166 | + |
| 167 | Controls whether server-side signed push validation is enabled on the |
| 168 | project. Only has an effect if signed push validation is enabled on the |
| 169 | server; see the link:config-gerrit.html#receive.enableSignedPush[global |
| 170 | configuration] for details. |
| 171 | + |
| 172 | Default is `INHERIT`, which means that this property is inherited from |
| 173 | the parent project. |
| 174 | |
Dave Borowitz | 0543c73 | 2015-10-20 10:35:26 -0400 | [diff] [blame] | 175 | [[receive.requireSignedPush]]receive.requireSignedPush:: |
| 176 | + |
| 177 | Controls whether server-side signed push validation is required on the |
| 178 | project. Only has an effect if signed push validation is enabled on the |
| 179 | server, and link:#receive.enableSignedPush is set on the project. See |
| 180 | the link:config-gerrit.html#receive.enableSignedPush[global |
| 181 | configuration] for details. |
| 182 | + |
| 183 | Default is `INHERIT`, which means that this property is inherited from |
| 184 | the parent project. |
| 185 | |
Saša Živkov | 225b7a7 | 2015-11-17 17:37:43 +0100 | [diff] [blame] | 186 | [[receive.rejectImplicitMerges]]receive.rejectImplicitMerges:: |
| 187 | + |
| 188 | Controls whether a check for implicit merges will be performed when changes are |
| 189 | pushed for review. An implicit merge is a case where merging an open change |
| 190 | would implicitly merge another branch into the target branch. Typically, this |
| 191 | happens when a change is done on master and, by mistake, pushed to a stable branch |
| 192 | for review. When submitting such change, master would be implicitly merged into |
| 193 | stable without anyone noticing that. When this option is set to 'true' Gerrit |
| 194 | will reject the push if an implicit merge is detected. |
| 195 | + |
| 196 | This check is only done for non-merge commits, merge commits are not subject of |
| 197 | the implicit merge check. |
| 198 | + |
| 199 | Default is `INHERIT`, which means that this property is inherited from |
| 200 | the parent project. |
| 201 | |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 202 | [[submit-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 203 | === Submit section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 204 | |
| 205 | The submit section includes configuration of project-specific |
| 206 | submit settings: |
| 207 | |
| 208 | - 'mergeContent': Defines whether to automatically merge changes. Valid values |
| 209 | are 'true', 'false', or 'INHERIT'. Default is 'INHERIT'. |
| 210 | |
Stefan Lay | 08ba473 | 2014-05-05 16:36:12 +0200 | [diff] [blame] | 211 | - 'action': defines the link:project-configuration.html#submit_type[submit type]. Valid |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 212 | values are 'fast forward only', 'merge if necessary', 'rebase if necessary', |
| 213 | 'merge always' and 'cherry pick'. The default is 'merge if necessary'. |
| 214 | |
Patrick Hiesel | 5a31635 | 2017-06-22 15:38:06 +0200 | [diff] [blame^] | 215 | - 'matchAuthorToCommitterDate': Defines whether to the author date will be changed to match the |
| 216 | submitter date upon submit, so that git log shows when the change was submitted instead of when the |
| 217 | author last committed. Valid values are 'true', 'false', or 'INHERIT'. The default is 'INHERIT'. |
| 218 | This option only takes effect in submit strategies which already modify the commit, i.e. |
| 219 | Cherry Pick, Rebase Always, and (perhaps) Rebase If Necessary. |
| 220 | |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 221 | Merge strategy |
| 222 | |
| 223 | |
| 224 | [[access-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 225 | === Access section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 226 | |
| 227 | Each +access+ section includes a reference and access rights connected |
| 228 | to groups. Each group listed must exist in the link:#file-groups[+groups+ file]. |
| 229 | |
| 230 | Please refer to the |
| 231 | link:access-control.html#access_categories[Access Categories] |
| 232 | documentation for a full list of available access rights. |
| 233 | |
| 234 | |
Shawn Pearce | 9cfcebd | 2014-04-25 16:41:12 -0700 | [diff] [blame] | 235 | [[mimetype-section]] |
| 236 | === MIME Types section |
| 237 | |
| 238 | The +mimetype+ section may be configured to force the web code |
| 239 | reviewer to return certain MIME types by file path. MIME types |
| 240 | may 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 Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 250 | [[capability-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 251 | === Capability section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 252 | |
| 253 | The +capability+ section only appears once, and only in the +All-Projects+ |
| 254 | repository. It controls Gerrit administration capabilities that are configured |
| 255 | on a global level. |
| 256 | |
| 257 | Please refer to the |
| 258 | link:access-control.html#global_capabilities[Global Capabilities] |
| 259 | documentation for a full list of available capabilities. |
| 260 | |
David Myllykangas | b3ccec6 | 2015-01-21 15:41:13 +0100 | [diff] [blame] | 261 | [[label-section]] |
| 262 | === Label section |
| 263 | |
| 264 | Please refer to link:config-labels.html#label_custom[Custom Labels] documentation. |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 265 | |
Saša Živkov | 944b838 | 2014-05-08 14:02:15 +0200 | [diff] [blame] | 266 | [[branchOrder-section]] |
| 267 | === branchOrder section |
| 268 | |
| 269 | Defines a branch ordering which is used for backporting of changes. |
| 270 | Backporting will be offered for a change (in the Gerrit UI) for all |
| 271 | more stable branches where the change can merge cleanly. |
| 272 | |
| 273 | [[branchOrder.branch]]branchOrder.branch:: |
| 274 | + |
| 275 | A branch name, typically multiple values will be defined. The order of branch |
| 276 | names in this section defines the branch order. The topmost is considered to be |
| 277 | the least stable branch (typically the master branch) and the last one the |
| 278 | most stable (typically the last maintained release branch). |
| 279 | |
| 280 | Example: |
| 281 | |
| 282 | ---- |
| 283 | [branchOrder] |
| 284 | branch = master |
| 285 | branch = stable-2.9 |
| 286 | branch = stable-2.8 |
| 287 | branch = stable-2.7 |
| 288 | ---- |
| 289 | |
| 290 | The `branchOrder` section is inheritable. This is useful when multiple or all |
| 291 | projects follow the same branch rules. A `branchOrder` section in a child |
| 292 | project completely overrides any `branchOrder` section from a parent i.e. there |
| 293 | is no merging of `branchOrder` sections. A present but empty `branchOrder` |
| 294 | section removes all inherited branch order. |
| 295 | |
| 296 | Branches not listed in this section will not be included in the mergeability |
| 297 | check. If the `branchOrder` section is not defined then the mergeability of a |
| 298 | change into other branches will not be done. |
| 299 | |
Patrick Hiesel | 6db5afd | 2017-03-21 09:40:03 +0100 | [diff] [blame] | 300 | [[reviewer-section]] |
| 301 | === reviewer section |
| 302 | |
| 303 | Defines config options to adjust a project's reviewer workflow such as enabling |
| 304 | reviewers and CCs by email. |
| 305 | |
| 306 | [[reviewer.enableByEmail]]reviewer.enableByEmail:: |
| 307 | + |
| 308 | A boolean indicating if reviewers and CCs that do not currently have a Gerrit |
| 309 | account can be added to a change by providing their email address. |
| 310 | |
Patrick Hiesel | 502b26c | 2017-03-29 14:19:23 +0200 | [diff] [blame] | 311 | Default is `INHERIT`, which means that this property is inherited from |
| 312 | the parent project. If the property is not set in any parent project, the |
| 313 | default value is `FALSE`. |
Saša Živkov | 944b838 | 2014-05-08 14:02:15 +0200 | [diff] [blame] | 314 | |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 315 | [[file-groups]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 316 | == The file +groups+ |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 317 | |
| 318 | Each group in this list is linked with its UUID so that renaming of |
| 319 | groups is possible without having to rewrite every +groups+ file |
| 320 | in every repository where it's used. |
| 321 | |
| 322 | This is what the default groups file for +All-Projects.git+ looks like: |
| 323 | |
| 324 | ---- |
| 325 | # UUID Group Name |
| 326 | # |
| 327 | 3d6da7dc4e99e6f6e5b5196e21b6f504fc530bba Administrators |
| 328 | global:Anonymous-Users Anonymous Users |
Khai Do | 5aaeee3 | 2014-09-05 10:14:32 -0700 | [diff] [blame] | 329 | global:Change-Owner Change Owner |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 330 | global:Project-Owners Project Owners |
| 331 | global:Registered-Users Registered Users |
| 332 | ---- |
| 333 | |
| 334 | This file can't be written to by the +git config+ command. |
| 335 | |
| 336 | In order to reference a group in +project.config+, it must be listed in |
| 337 | the +groups+ file. When editing permissions through the web UI this |
| 338 | file 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 | |
| 342 | The UUID of a group can be found on the General tab of the group's page |
| 343 | in the web UI or via the +-v+ option to |
| 344 | link:cmd-ls-groups.html[the +ls-groups+ SSH command]. |
| 345 | |
| 346 | |
| 347 | [[file-rules_pl]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 348 | == The file +rules.pl+ |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 349 | |
| 350 | The +rules.pl+ files allows you to replace or amend the default Prolog |
| 351 | rules that control e.g. what conditions need to be fulfilled for a |
| 352 | change to be submittable. This file content should be |
| 353 | interpretable by the 'Prolog Cafe' interpreter. |
| 354 | |
| 355 | You can read more about the +rules.pl+ file and the prolog rules on |
| 356 | link:prolog-cookbook.html[the Prolog cookbook page]. |
| 357 | |
| 358 | GERRIT |
| 359 | ------ |
| 360 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 361 | |
| 362 | SEARCHBOX |
| 363 | --------- |