How to edit the project.config for all projects in Gerrit

While I was evaluating Gerrit 2.6 I ended up installing the building the latest snapshot version (2.7RC) myself. All was fine until I was about to setup Jenkins to verify my commits. I was surprised to find the label "Verified" missing from the reviews. After some googling I found that in version 2.7 this has been removed and needed to be added manually in the project.config. After searching my drives I could not find this project.config only to realize that this is a file in the meta config. And this below is how you edit it:

mkdir tmp
cd tmp
git init
git remote add origin ssh://admin@remote.site.com:29418/All-Projects
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config


Now you should have the project.config in you temp folder. Add the label as below:

[label "Verified"]
       function = MaxWithBlock
       value = -1 Fails
       value =  0 No score
       value = +1 Verified


Next you need to commit and push back to Gerrit. Ofcourse make sure you have the appropriate rights.

git commit -a
git push origin meta/config:meta/config

Join the conversation

17 Comments

  1. This problem really confused me for quite some time, until find this post.

    Thanks for your detailed step by step guide on how to change project.config setting for Gerrit, which I think should be in official Gerrit document, but missing instead.

  2. Thanks for this post. I find it rather peculiar this is not mentioned in the documentation. You can figure this out, sure, but that’s what the doc is for, to describe mechanisms like these. Is this the “proper gerrit” way of editing project.config?

    Sometimes I have the impression either the configuration of gerrit is not yet mature or it is me since I do not grasp 100% the concept of gerrit administration

  3. Yeah I have also found this about the project.config file.
    All the documentation just says edit this file and add these entries.

    rather confusing…..

  4. Hi Peter,

    Thanks for this. It really helped. We followed the steps mentioned in this document. However,in the Access control list inside the All Projects, we are unable to see the Label: Verify in the ref/heads/* .

    We are very new to Gerrit. Any help on this would be much appreciated.

    Thanks,

    Arun Srinivasan

    1. Hi Arun,

      You will need to add the permission to the refs/heads/* by editting the All-Projects access and adding the permission “Label Verified”

  5. Hi,
    I need to specify a certain branch in the label section in order to block submitting commits regarding the specific branch. Am I right with the following config:
    [label “TestLabel”]
    branch = refs/heads/
    function = MaxWithBlock
    value = -1 Fails
    value = 0 No score
    value = +1 Verified

  6. in 2021 & gerrit 3.4.1, there is a new way to modify project.config:

    BROWSE-Repositories-“All-Projects”-Commands-EDIT_REPO_CONFIG

Leave a comment

Leave a Reply to xlabiq Cancel reply

Your email address will not be published. Required fields are marked *