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 | |
| 23 | |
| 24 | [[file-project_config]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 25 | == The file +project.config+ |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 26 | |
| 27 | The +project.config+ file contains the link between groups and their |
| 28 | permitted actions on reference patterns in this project and any projects |
| 29 | that inherit its permissions. |
| 30 | |
| 31 | The format in this file corresponds to the Git config file format, so |
| 32 | if 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 |
| 34 | don't accidentally break the format of the file. |
| 35 | |
| 36 | Here follows a +git config+ command example: |
| 37 | |
| 38 | ---- |
| 39 | $ git config -f project.config project.description "Rights inherited by all other projects" |
| 40 | ---- |
| 41 | |
| 42 | Below 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 | |
| 55 | As you can see, there are several sections. |
| 56 | |
| 57 | The link:#project-section[+project+ section] appears once per project. |
| 58 | |
| 59 | The link:#access-section[+access+ section] appears once per reference pattern, |
| 60 | such as `refs/*` or `refs/heads/*`. Only one access section per pattern is |
| 61 | allowed. You will find examples of keys and values in each category section |
| 62 | <<access_category,below>>. |
| 63 | |
| 64 | The link:#receive-section[+receive+ section] appears once per project. |
| 65 | |
| 66 | The link:#submit-section[+submit+ section] appears once per project. |
| 67 | |
| 68 | The link:#capability-section[+capability+] section only appears once, and only |
| 69 | in the +All-Projects+ repository. It controls core features that are configured |
| 70 | on a global level. You can find examples of these |
| 71 | <<capability_category,below>>. |
| 72 | |
| 73 | |
| 74 | [[project-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 75 | === Project section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 76 | |
| 77 | The project section includes configuration of project settings. |
| 78 | |
| 79 | These are the keys: |
| 80 | |
| 81 | - Description |
| 82 | |
| 83 | |
| 84 | [[receive-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 85 | === Receive section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 86 | |
| 87 | The receive section includes configuration of project-specific |
| 88 | receive settings: |
| 89 | |
| 90 | [[receive.requireContributorAgreement]]receive.requireContributorAgreement:: |
| 91 | + |
| 92 | Controls whether or not a user must complete a contributor agreement before |
| 93 | they can upload changes. Default is `INHERIT`. If `All-Project` enables this |
| 94 | option then the dependent project must set it to false if users are not |
| 95 | required to sign a contributor agreement prior to submitting changes for that |
| 96 | specific project. To use that feature the global option in `gerrit.config` |
| 97 | must be enabled: |
| 98 | link:config-gerrit.html#auth.contributorAgreements[auth.contributorAgreements]. |
| 99 | |
| 100 | [[receive.requireSignedOffBy]]receive.requireSignedOffBy:: |
| 101 | + |
| 102 | Sign-off can be a requirement for some projects (for example Linux kernel uses |
| 103 | it). Sign-off is a line at the end of the commit message which certifies who |
| 104 | is the author of the commit. Its main purpose is to improve tracking of who |
| 105 | did what, especially with patches. Default is `INHERIT`, which means that this |
| 106 | property is inherited from the parent project. |
| 107 | |
| 108 | [[receive.requireChangeId]]receive.requireChangeId:: |
| 109 | + |
| 110 | Controls whether or not the Change-Id must be included in the commit message |
| 111 | in the last paragraph. Default is `INHERIT`, which means that this property |
| 112 | is inherited from the parent project. |
| 113 | |
| 114 | [[receive.maxObjectSizeLimit]]receive.maxObjectSizeLimit:: |
| 115 | + |
| 116 | Maximum allowed Git object size that receive-pack will accept. If an object |
| 117 | is larger than the given size the pack-parsing will abort and the push |
| 118 | operation will fail. If set to zero then there is no limit. |
| 119 | + |
| 120 | Project owners can use this setting to prevent developers from pushing |
| 121 | objects which are too large to Gerrit. This setting can also be set it |
| 122 | `gerrit.config` globally link:config-gerrit.html#receive.maxObjectSizeLimit[ |
| 123 | receive.maxObjectSizeLimit]. |
| 124 | + |
| 125 | The project specific setting in `project.config` is only honored when it |
| 126 | further reduces the global limit. |
| 127 | + |
| 128 | Default is zero. |
| 129 | + |
| 130 | Common unit suffixes of k, m, or g are supported. |
| 131 | |
Rob Ward | 2cf1295 | 2014-01-26 20:38:12 +0000 | [diff] [blame] | 132 | [[receive.checkReceivedObjects]]receive.checkReceivedObjects:: |
| 133 | + |
| 134 | Controls whether or not the JGit functionality for checking received objects |
| 135 | is enabled. |
| 136 | + |
| 137 | By default Gerrit checks the validity of git objects. Setting this variable to |
| 138 | false should not be used unless a project with history containing invalid |
| 139 | objects needs to be pushed into a Gerrit repository. |
| 140 | + |
| 141 | This functionality is provided as some other git implementations have allowed |
| 142 | bad history to be written into git repositories. If these repositories need pushing |
| 143 | up to Gerrit then the JGit checks need to be disabled. |
| 144 | + |
| 145 | The default value for this is true, false disables the checks. |
| 146 | |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 147 | [[submit-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 148 | === Submit section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 149 | |
| 150 | The submit section includes configuration of project-specific |
| 151 | submit settings: |
| 152 | |
| 153 | - 'mergeContent': Defines whether to automatically merge changes. Valid values |
| 154 | are 'true', 'false', or 'INHERIT'. Default is 'INHERIT'. |
| 155 | |
Stefan Lay | 08ba473 | 2014-05-05 16:36:12 +0200 | [diff] [blame] | 156 | - 'action': defines the link:project-configuration.html#submit_type[submit type]. Valid |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 157 | values are 'fast forward only', 'merge if necessary', 'rebase if necessary', |
| 158 | 'merge always' and 'cherry pick'. The default is 'merge if necessary'. |
| 159 | |
| 160 | Merge strategy |
| 161 | |
| 162 | |
| 163 | [[access-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 164 | === Access section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 165 | |
| 166 | Each +access+ section includes a reference and access rights connected |
| 167 | to groups. Each group listed must exist in the link:#file-groups[+groups+ file]. |
| 168 | |
| 169 | Please refer to the |
| 170 | link:access-control.html#access_categories[Access Categories] |
| 171 | documentation for a full list of available access rights. |
| 172 | |
| 173 | |
Shawn Pearce | 9cfcebd | 2014-04-25 16:41:12 -0700 | [diff] [blame] | 174 | [[mimetype-section]] |
| 175 | === MIME Types section |
| 176 | |
| 177 | The +mimetype+ section may be configured to force the web code |
| 178 | reviewer to return certain MIME types by file path. MIME types |
| 179 | may 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 Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 189 | [[capability-section]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 190 | === Capability section |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 191 | |
| 192 | The +capability+ section only appears once, and only in the +All-Projects+ |
| 193 | repository. It controls Gerrit administration capabilities that are configured |
| 194 | on a global level. |
| 195 | |
| 196 | Please refer to the |
| 197 | link:access-control.html#global_capabilities[Global Capabilities] |
| 198 | documentation for a full list of available capabilities. |
| 199 | |
| 200 | |
Saša Živkov | 944b838 | 2014-05-08 14:02:15 +0200 | [diff] [blame^] | 201 | [[branchOrder-section]] |
| 202 | === branchOrder section |
| 203 | |
| 204 | Defines a branch ordering which is used for backporting of changes. |
| 205 | Backporting will be offered for a change (in the Gerrit UI) for all |
| 206 | more stable branches where the change can merge cleanly. |
| 207 | |
| 208 | [[branchOrder.branch]]branchOrder.branch:: |
| 209 | + |
| 210 | A branch name, typically multiple values will be defined. The order of branch |
| 211 | names in this section defines the branch order. The topmost is considered to be |
| 212 | the least stable branch (typically the master branch) and the last one the |
| 213 | most stable (typically the last maintained release branch). |
| 214 | |
| 215 | Example: |
| 216 | |
| 217 | ---- |
| 218 | [branchOrder] |
| 219 | branch = master |
| 220 | branch = stable-2.9 |
| 221 | branch = stable-2.8 |
| 222 | branch = stable-2.7 |
| 223 | ---- |
| 224 | |
| 225 | The `branchOrder` section is inheritable. This is useful when multiple or all |
| 226 | projects follow the same branch rules. A `branchOrder` section in a child |
| 227 | project completely overrides any `branchOrder` section from a parent i.e. there |
| 228 | is no merging of `branchOrder` sections. A present but empty `branchOrder` |
| 229 | section removes all inherited branch order. |
| 230 | |
| 231 | Branches not listed in this section will not be included in the mergeability |
| 232 | check. If the `branchOrder` section is not defined then the mergeability of a |
| 233 | change into other branches will not be done. |
| 234 | |
| 235 | |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 236 | [[file-groups]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 237 | == The file +groups+ |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 238 | |
| 239 | Each group in this list is linked with its UUID so that renaming of |
| 240 | groups is possible without having to rewrite every +groups+ file |
| 241 | in every repository where it's used. |
| 242 | |
| 243 | This is what the default groups file for +All-Projects.git+ looks like: |
| 244 | |
| 245 | ---- |
| 246 | # UUID Group Name |
| 247 | # |
| 248 | 3d6da7dc4e99e6f6e5b5196e21b6f504fc530bba Administrators |
| 249 | global:Anonymous-Users Anonymous Users |
| 250 | global:Project-Owners Project Owners |
| 251 | global:Registered-Users Registered Users |
| 252 | ---- |
| 253 | |
| 254 | This file can't be written to by the +git config+ command. |
| 255 | |
| 256 | In order to reference a group in +project.config+, it must be listed in |
| 257 | the +groups+ file. When editing permissions through the web UI this |
| 258 | file is maintained automatically, but when pushing updates to |
| 259 | +refs/meta/config+ this must be dealt with by hand. Gerrit will refuse |
| 260 | +project.config+ files that refer to groups not listed in +groups+. |
| 261 | |
| 262 | The UUID of a group can be found on the General tab of the group's page |
| 263 | in the web UI or via the +-v+ option to |
| 264 | link:cmd-ls-groups.html[the +ls-groups+ SSH command]. |
| 265 | |
| 266 | |
| 267 | [[file-rules_pl]] |
Yuxuan 'fishy' Wang | 61698b1 | 2013-12-20 12:55:51 -0800 | [diff] [blame] | 268 | == The file +rules.pl+ |
Fredrik Luthander | a3cf354 | 2012-07-04 16:55:35 -0700 | [diff] [blame] | 269 | |
| 270 | The +rules.pl+ files allows you to replace or amend the default Prolog |
| 271 | rules that control e.g. what conditions need to be fulfilled for a |
| 272 | change to be submittable. This file content should be |
| 273 | interpretable by the 'Prolog Cafe' interpreter. |
| 274 | |
| 275 | You can read more about the +rules.pl+ file and the prolog rules on |
| 276 | link:prolog-cookbook.html[the Prolog cookbook page]. |
| 277 | |
| 278 | GERRIT |
| 279 | ------ |
| 280 | Part of link:index.html[Gerrit Code Review] |
Yuxuan 'fishy' Wang | 99cb68d | 2013-10-31 17:26:00 -0700 | [diff] [blame] | 281 | |
| 282 | SEARCHBOX |
| 283 | --------- |