Define Gerrit Label in level project but exclude some repos

138 views
Skip to first unread message

Ashish Kumar

unread,
Mar 19, 2024, 8:27:14 AM3/19/24
to Repo and Gerrit Discussion
Hi,

I have Gerrit top level project repo where I have defined access rights, I've some odd 15 repositories which inherit rights from top level project.

I want to define Unit-test label in 10 sub repos and excluding 5 repos at the top level project. I don't want to go in each repos and define the label in the project.config file rather want to define at top level project repo but how can i exclude those 5 repos that are also inheriting from top level project?

Appreciate any kind of help.

Thanks

Matthias Sohn

unread,
Mar 19, 2024, 9:01:24 AM3/19/24
to Ashish Kumar, Repo and Gerrit Discussion
The depth of the project hierarchy in Gerrit is not limited to 2. 
You can add another project e.g. "MyLabel" under "All-Projects" adding the additional label and 
let the projects which should use this label definition inherit from the "MyLabel" project.

-Matthias

Ashish Kumar

unread,
Mar 19, 2024, 9:27:33 AM3/19/24
to Repo and Gerrit Discussion
Correct that is how my current config is ie. My top level project is named as let's say Stockholm
which inherits from company wide rules set by admins ie All Projects
[access]

inheritFrom = All-Projects


To manage access for my project at my end instead of reaching out to admins, I had created Stockholm as top level project repo
where I inherits as below
[access]

inheritFrom =
Stockholm  

[submit]


action = inherit

My understanding is if I add below label it is gonna affect at 15 repos. And I cannot make those 5 repos inherit rights from somewhere else other than Stockholm due to some limitations but I want these repos not to have Unit-test label defined in it. Is there a way to override?

[label "Unit-Test"]


value = -1 Failed


value = 0 Not Run


value = +1 Passed


defaultValue = 0


function = MaxBlock
  

Yingchun Li

unread,
Mar 20, 2024, 5:07:18 AM3/20/24
to Repo and Gerrit Discussion
On Tuesday, March 19, 2024 at 9:01:24 PM UTC+8 Matthias Sohn wrote:
On Tue, Mar 19, 2024 at 1:27 PM Ashish Kumar <ashis...@gmail.com> wrote:
Hi,

I have Gerrit top level project repo where I have defined access rights, I've some odd 15 repositories which inherit rights from top level project.

I want to define Unit-test label in 10 sub repos and excluding 5 repos at the top level project. I don't want to go in each repos and define the label in the project.config file rather want to define at top level project repo but how can i exclude those 5 repos that are also inheriting from top level project?

Appreciate any kind of help.

The depth of the project hierarchy in Gerrit is not limited to 2. 
Oh, could you give a link about the inherit limitation? 

Martin Fick

unread,
Mar 20, 2024, 12:20:34 PM3/20/24
to Yingchun Li, Repo and Gerrit Discussion
On Wed, Mar 20, 2024 at 3:07 AM Yingchun Li <sword.l...@gmail.com> wrote:
On Tuesday, March 19, 2024 at 9:01:24 PM UTC+8 Matthias Sohn wrote:
On Tue, Mar 19, 2024 at 1:27 PM Ashish Kumar <ashis...@gmail.com> wrote:
I have Gerrit top level project repo where I have defined access rights, I've some odd 15 repositories which inherit rights from top level project.

I want to define Unit-test label in 10 sub repos and excluding 5 repos at the top level project. I don't want to go in each repos and define the label in the project.config file rather want to define at top level project repo but how can i exclude those 5 repos that are also inheriting from top level project?
...

The depth of the project hierarchy in Gerrit is not limited to 2. 
Oh, could you give a link about the inherit limitation? 

Yingchun Li

unread,
Mar 20, 2024, 11:42:37 PM3/20/24
to Repo and Gerrit Discussion
Thank you Martin, 
But I still can not find the depth limitation of inheritance, as the doc says:
Projects in Gerrit are organized hierarchically as a tree with the All-Projects project as root from which all projects inherit. Each project can have only a single parent project, multi-inheritance is not supported

IMO,  

         All-Projects
       /              \
     /                  \
   A                     B
    \                   /
       \              /
         \          /
             C
is not allowed, but how about B inherit All-Projects, and C inherit B, and D inherit C...

         All-Projects
                 |
                 B
                 |
                 C
                 |
                 D

-Martin

Martin Fick

unread,
Mar 21, 2024, 11:41:25 AM3/21/24
to Yingchun Li, Repo and Gerrit Discussion
On Wed, Mar 20, 2024 at 9:42 PM Yingchun Li <sword.l...@gmail.com> wrote:
On Thursday, March 21, 2024 at 12:20:34 AM UTC+8 Martin Fick wrote:
On Wed, Mar 20, 2024 at 3:07 AM Yingchun Li <sword.l...@gmail.com> wrote:
On Tuesday, March 19, 2024 at 9:01:24 PM UTC+8 Matthias Sohn wrote:
On Tue, Mar 19, 2024 at 1:27 PM Ashish Kumar <ashis...@gmail.com> wrote:
I have Gerrit top level project repo where I have defined access rights, I've some odd 15 repositories which inherit rights from top level project.

I want to define Unit-test label in 10 sub repos and excluding 5 repos at the top level project. I don't want to go in each repos and define the label in the project.config file rather want to define at top level project repo but how can i exclude those 5 repos that are also inheriting from top level project?
...

The depth of the project hierarchy in Gerrit is not limited to 2. 
Oh, could you give a link about the inherit limitation? 
Thank you Martin, 
But I still can not find the depth limitation of inheritance, as the doc says:
Projects in Gerrit are organized hierarchically as a tree with the All-Projects project as root from which all projects inherit. Each project can have only a single parent project, multi-inheritance is not supported
 
You will not find a limit documented because there is no depth limitation.
 
IMO,  

         All-Projects
       /              \
     /                  \
   A                     B
    \                   /
       \              /
         \          /
             C
is not allowed, but how about B inherit All-Projects, and C inherit B, and D inherit C...

         All-Projects
                 |
                 B
                 |
                 C
                 |
                 D
 
Yes, that is what that sentence from the docs means,

-Martin

Yingchun Li

unread,
Mar 21, 2024, 11:23:51 PM3/21/24
to Repo and Gerrit Discussion
Thanks for clarifying. 
-Martin
Reply all
Reply to author
Forward
0 new messages