Configuration

Quota

The defined quotas are stored in a quota.config file in the refs/meta/config branch of the All-Projects root project. Administrators can add and edit quotas by fetching this branch, editing the quota.config file locally and pushing back the changes. The quota.config file is a Git config file:

  [quota "sandbox/*"]
    maxProjects = 50
    maxRepoSize = 2 m
  [quota "public/*"]
    maxProjects = 100
    maxRepoSize = 10 m
  [quota "customerX/*"]
    maxProjects = 20
    maxTotalSize = 200 m

If both “maxRepoSize” and “maxTotalSize” are defined in a quota section then the more limiting quota will apply. For example, if the remaining repository size of a repository (based on the “maxRepoSize” and currently occupied space of that repository) is 2m and the remaining total size (based on the “maxTotalSize” and currently occupied space of all repositoris under that namespace) is 1m then the 1m is the remaining size for that repository.

A namespace can be specified as

  • exact project name (plugins/myPlugin): Defines a quota for one project.

  • pattern (sandbox/*): Defines a quota for one project namespace.

  • regular expression (^test-.*/.*): Defines a quota for the namespace matching the regular expression.

  • for-each-pattern (?/*): Defines the same quota for each subfolder. ? is a placeholder for any name and ‘?/*’ with ‘maxProjects = 3’ means that for every subfolder 3 projects are allowed. Hence ‘?/*’ is a shortcut for having n explicit quotas: ‘/*’ with ‘maxProjects = 3’ ‘/*’ with ‘maxProjects = 3’ ...

If a project name matches several quota namespaces the one quota applies to the project that is defined first in the quota.config file.

Example: Allow the creation of 10 projects in folder test/* and maximal 500 projects in total

  [quota "test/*"]
    maxProjects = 10
  [quota "*"]
    maxProjects = 500

Example: Allow the creation of 10 projects in folder test/* and 5 projects in each other folder

  [quota "test/*"]
    maxProjects = 10
  [quota "?/*"]
    maxProjects = 5

Example: Allow the creation of 10 projects in folder ‘test/*’ and set the quota of 2m for each of them

  [quota "test/*"]
    maxProjects = 10
    maxRepoSize = 2 m

Example: Allow the creation of 10 projects in folder ‘test/*’ and set a quota of 20m for the total size of all repositories

  [quota "test/*"]
    maxProjects = 10
    maxTotalSize = 20 m

Example: Allow the creation of 10 projects in folder ‘test/*’ and set a quota of 20m for the total size of all repositories. In addition make sure that each individual repository cannot exceed 3m

  [quota "test/*"]
    maxProjects = 10
    maxRepoSize = 3 m
    maxTotalSize = 20 m

If one prefers computing a repository size by adding the size of the git objects, the following section should be added into the gerrit.config file:

  [plugin "quota"]
        useGitObjectCount = true

Publication Schedule

Publication of repository sizes to registered UsageDataPublishedListeners is configured in the plugin.quota subsection of the gerrit.config file. The publication interval can be configured using the same format as for the garbage collection schedule, with the parameter names ‘publicationStartTime’ and ‘publicationInterval’.

Example:

  [plugin "quota"]
    publicationStartTime = Fri 10:30
    publicationInterval  = 1 day

If no publicationInterval is configured, no data is published.