Issue 2387: Cannot assign existing Gerrit groups to permissions.
Status:  Invalid
Owner: ----
Closed:  Jan 2014
Project Member Reported by zaro0508, Jan 8, 2014
When I attempt to assign an existing gerrit group (which is not in the groups file) to an label I get an error that says 'remote: error:   project.config: group "Change Owner" not in groups'.  This bug occurs when attempting to assign any existing Gerrit group, not just the "Change Owner" group.  The error goes away if the Change Owner group is added to the groups file but the only way to do that is thru the GUI.  This problem is preventing us from automating Gerrit project configurations.

Affected Version: 2.8

What steps will reproduce the problem?
1. create a new gerrit site
2. clone All-Projects
*Note - the groups file does not contain an entry for "Change Owner"
3. add a label 'Foo' to project.config, something like..
[label "Foo"]
        value = -1 A
        value =   0 B
        value = +1 C

4. Assign "Change Owner" group to Foo label for "refs/heads/*"
  [access "refs/heads/*"]
        label-Foo = -1..+1 group Change Owners

5. push to All-Projects (git push origin HEAD:refs/meta/config)

What is the expected output? What do you see instead?
I would expect to be able to create this label and assign it to any group that's already defined in Gerrit.  "Change Owner" is a Gerrit system group and by default it doesn't get assigned to any permissions in All-Projects.

What i get is an error..

Writing objects: 100% (3/3), 487 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1)
remote: Processing changes: refs: 1, done
remote: error: Invalid project configuration:
remote: error:   project.config: group "Change Owner" not in groups
To http://localhost:8080/All-Projects
 ! [remote rejected] HEAD -> refs/meta/config (invalid project configuration)
error: failed to push some refs to 'http://localhost:8080/All-Projects'


The error goes aways after I use the Gerrit GUI to assign "Change Owner" to any permission in All-Projects.
Jan 9, 2014
Project Member #1 David.Os...@gmail.com
>4. Assign "Change Owner" group to Foo label for "refs/heads/*"
>  [access "refs/heads/*"]
>        label-Foo = -1..+1 group Change Owners

That's wrong. The group is called:
"Change Owner"

>The error goes away if the Change Owner group is added to the groups file but the >only way to do that is thru the GUI.

Not true:

Add this line to "groups" file:

global:Change-Owner                     	Change Owner

and commit and push together with the corrected change above:

label-Foo = -1..+1 group Change Owner
Status: Invalid
Jan 9, 2014
Project Member #2 zaro0508
You are correct about the group name.  However I don't see why this bug is invalid.  My point is that you should not even need to manually add the Change Owner reference to the group file.  I think my expectation is still valid.  
Jan 9, 2014
Project Member #3 David.Os...@gmail.com
(No comment was entered for this change.)
Status: New
Jan 9, 2014
Project Member #4 David.Os...@gmail.com
This always worked this way and it was documented in 2.8 Version [1]:

In order to reference a group in +project.config+, it must be listed in
the +groups+ file.  When editing permissions through the web UI this
file is maintained automatically, but when pushing updates to
+refs/meta/config+ this must be dealt with by hand.  Gerrit will refuse
+project.config+ files that refer to groups not listed in +groups+.


[1] https://gerrit-review.googlesource.com/Documentation/config-project-config.html#file-groups
Status: Invalid