feat: Allow "group/subgroup/" as keys to provide configuration that is not inherited recursively#986
feat: Allow "group/subgroup/" as keys to provide configuration that is not inherited recursively#986Anedaar wants to merge 1 commit intogitlabform:mainfrom
Conversation
…s not inherited recursively
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #986 +/- ##
==========================================
- Coverage 86.45% 81.86% -4.60%
==========================================
Files 73 73
Lines 3293 3297 +4
==========================================
- Hits 2847 2699 -148
- Misses 446 598 +152
🚀 New features to boost your workflow:
|
|
Thanks a very interesting contribution, @Anedaar, thank you! Have you perhaps compared it to our analysis of the alternative approach described here https://github.com/gitlabform/gitlabform/wiki/Current-and-proposed-way-of-selecting-targets ? |
|
I feel this PR is introducing breaking change. But more importantly, I don't understand the problem being solved based on the description. It just jumped into solutioning. For example in the proposed config, now it's not clear at all whether a given section is a subgroup or a project. It adds extra cognitive load to interpret the config and it can lead to lots of issues/confusions. I suggest opening a new issue or engage in an existing issue. Make the problem statement as clear as possible. We already have feature for breaking inheritance. |
|
We also cover this in https://github.com/gitlabform/gitlabform/wiki/Configuration-Syntax-v5-Draft#alternatives-for-includeexclude I think we shall handle an improved syntax for project/group selection in one go. |
|
Hey everyone, Apologies for catching you a bit off guard with this PR. Let me provide some context: I work for a small, but rapidly growing startup, and we expect our team of fewer than 10 developers to manage around 100 projects in the next six months, as we can build upon an existing codebase. Tasked with structuring our GitLab setup, I discovered GitLabForm—and I absolutely love it! No more clicking through hundreds of projects to check if all branches are protected as they should be or if all features are enabled/disabled correctly. However, since I’m new to GitLabForm, I may have missed some important configuration options. Here’s what we want to achieve: For external partners, we’ve created a group called So, I created a config like this: "external/*":
group_settings:
visibility: internal
"external/companyA/*":
group_settings:
visibility: private
"external/companyB/*":
group_settings:
visibility: privateNow, if someone adds Next, I created a config like this: "external/*":
group_settings:
visibility: internal
description: Projects with external partners.
group_members:
users:
anedaar:
access_level: Owner
"external/CompanyA/*":
group_settings:
visibility: private
description: Projects with CompanyA.This works well for While users and descriptions are specific settings where I don’t think inheritance makes sense, visibility usually does, just not in this case. The issue arises because Since the change seemed simple enough, I decided to skip the issue and go straight for a PR. With that background: I didn’t see that proposal initially. When I first read it, I thought it only applied to running GitLabForm, not to the projects_and_groups config section. However, my PR is essentially this version of your proposal (config part only): Proposed behavior:
Details:
The “no changes” here refer to the config only. I think this version has the advantage of not altering any existing behavior or invalidating existing configurations. This PR/syntax addresses your "more than one" issue:foo/bar/* applies to the group and all subgroups, while foo/bar/ only applies to the group itself. The latter is more specific and takes precedence. It also solves the "same syntax" issue:
For the running GitLabForm part:The current behavior is that
I personally don't see a use case to distinguish between running group settings or project settings for projects in a group. I think what matters is recursion (or lack thereof). But I trust your judgment on that. Regarding the reasoning: see above. One of the most unintuitive things for me when I first encountered GitLabForm was that it doesn’t distinguish between groups and their projects in the config. A config might look like this: foo/*:
group_settings:
<...>
project_settings:
<...>
members:
<...>
labels:
<...>Here, I don’t fully grasp all the details of this v5 draft yet, but it definitely sounds like a huge improvement. I love the idea of separating group-related and project-related settings. I think this will offer even more options than this PR. This PR could become part of 4.X but may be superseded by the linked v5 draft. |
|
Hi @Anedaar . Thanks for all of that details. There's a lot to unpack in there. It's possible I might have missed a few things from your reply. Regarding whether this is a breaking change or not - I'm still leaning towards this being a breaking change. The updated config syntax changes how we would read the config and what we'd expect to happen or interpret the config. As for your first example: I think it might be a matter of expectation. For example: if all subgroups under "external/*":
group_settings:
visibility: private
"external/CompanyA/*":
group_settings:
description: Projects with CompanyA.
"external/CompanyB/*":
group_settings:
description: Projects with CompanyB.To be fair, I do understand some of the limitations you've mentioned. GitLabForm is not perfect. For me personally, config readability is extremely important. A common proposal on this topic I've seen makes it impossible to infer what the config is doing from readability perspective. For example, the following maybe fine for automation but as I said, when reading the config, how do I know what's a project and what's a group? Currently the purpose of Also, there are other proposal about expanding on the wildcard usage for selecting a resource (e.g. group/project) to be updated. See #398 and #325 . That's why we probably should think about overall changes to config syntax, in terms of resource selection, so that all of these use cases are properly evaluated and then come up with a proposal/design, and then implementation. I think it's a huge undertaking that will require lots of time and effort. Will you be able to help lead this effort? What do you think @jimisola @gdubicki @TimKnight-DWP ? |
|
@amimas I think we have definetly fallen afoul of specifying some "group" settings under the |
|
@amimas @Anedaar In this scenario all projects get updated with the specific merge_request_channel etc, however what I want, is to set that integration at the group level, and to have the projects set |
This change allows groups and subgroups to be referenced as
<config_group> will only affect group and projects directly in group, but not any subgroups or projects in subgroups.
Similarly, <config_subgroup> will only affect group/subgroup and projects in it, but not any subsubgroups.
This allows e.g. for a group to be public, but for all subgroups to be private:
The feature as implemented recognizes the "inherit: false" flag. Keys marked "inherit: false" in "group/" will not be inherited from "group/*":
Subgroups of group_1 will have "key_a", group_1 itself will only have "key_b".
This feature should also solve issue #541.
This feature will probably become irrelevant once regexes are implemented.