New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow breaking configuration inheritence #326
Comments
Hi @amimas! Sorry for a late reply. We actually run into this need too, so I will probably implement it soon. Unless you’d like to give it a try? |
Hi @gdubicki - Thanks for acknowledging this request. I believe my colleague @ep-linden can look into implementing it. Can you give us some guidance? What should we name this config and any suggestions how to implement it? I imagine this is something that should be available at every level of the configs (i.e. project_settings, members, merge_requests, etc.) |
As we already have special keywords like So for your example case, the config (shortened to include only the membership) would look like this:
As you suggested, the Also breaking inheritance would only work from the top to the specific level. Example: imagine that we have a config If you set If you set If you set Does that make sense, @amimas @ep-linden? If so, then I think that we only need to update the |
Thanks for all that details @gdubicki . That makes sense to me and is also what I was thinking how this feature would work. Question on the config keyword, Maybe I'm over thinking this? Perhaps it's not going to be confusing because the users of gitlabform is expected to have certain knowledge about how gitlab works. Thoughts? |
Yes, there is a slight naming clash here with gitlab's terminology and this is not perfect. But "inheritance" is also a term used in gitlabform from the start and I frankly don't have any alternative ideas.. Do you have? Anyway, this is something we can agree on later (maybe someone else will chip in?) - it should not block you from creating the PR. :) |
That's a good point. I couldn't think of an alternative either. And I agree this can be improved later, if needed. |
In the Maven POM world, the merging of XML behaviour that works similar to what's being requested here is controlled by an attribute called How's something along the lines of Here's how it might look:
|
@gdubicki I have started taking a look at this. I will update here accordingly. |
Hey @ep-linden, I got some email notify but I don’t see your comment here.. Anyway I think it would be easiest to discuss this further if you would share even a draft PR with your code so please don’t hesitate if you have it even half-baked. :) |
@gdubicki I had a few design questions, but I thought I'd just test it out first so I deleted it. I'll open up a draft PR today. |
We have released a pre-release v2.11.0b1 with this feature. 🥳 Thanks again for all your work on this, @ep-linden and your cooperation @amimas! Please test it out and check if all works without issues so we can release a final release. We can still change the keyword from ...however as in the following months we plan to release gitlabform v3 where most probably we will use YAML tags for this feature anyway. Together with @jimisola in #331 we discussed having |
I've noticed that when we run gitlabform with |
Oh, interesting, I've been primarily testing the break-inheritance flag running GitLab with |
I did test it out again, and it's working fine with |
not working for some configurations (#326). Without this change, when I run the app on my config, using ALL_DEFINED, at some point the self.configuration in the GitLabForm object gets changed: "inherit: false" entries are gone and subsequent calls to the ConfigurationProjectsAndGroups.get_effective_config_for_project() return configs without breaking inheritance. The bug has to be caused by removal if the "inherit: false" that we do in replace_config_sections() because we have been manipulating *references* to the single self.configuration here. deepcopy() makes sure that we only change copies of it and fixes the bug according to my test runs on my real config. Unfortunately I am not able to reproduce the bug with a unit test.
There definitely was a bug, I fixed it (or rather worked around it, really :( ) and released v2.11.0b3 with the fix now. See the message of the commit above for more info, @ep-linden. |
@gdubicki I just saw the changes. Would you be able to provide what you did, so I can reproduce it locally? |
Sorry @ep-linden, but as I have written in the 652b343 commit message, I was not able to reproduce the bug with unit or acceptance tests, only with my company's 1.6k LOC real-world config and I cannot share that... |
The final release v2.11.0 with this feature is out. Thanks again for the cooperation, @ep-linden and @amimas! |
Oh okay, that's what I was wondering. Obviously won't ask for your company's config haha. Thanks, Greg! |
Is this only working for "members" or other settings as well? PS. Also, inheritance seems to misspelt in the subject. |
This should be working for everything, any part of the configuration, @lfvjimisola. |
It'd probably be helpful if the inherit flag is used in the sample config.yaml file. I guess that was missed in the PR that added the feature. @ep-linden - do you think you can add couple examples? |
Good catch, I'll do that. |
Are there any examples available? I'm hoping that this could help with an issue we have. We have a bunch of projects under TG/* for which set options related to repositories (project_settings, project_push_rules, merge_requests). However, for some projects under TG/* we've disabled the Git Repositories (we only use the Issue functionality). When we run gitlabform we then get:
Can I use the inherit flag explicitly for these projects to avoid the error? |
Could you share a snippet of the config being used? |
Interesting that GitHub doesn't allow yml files to be uploaded. Our config.yml is attached. No imagine that one of the projects under sysdev/... have the repository functionality disabled (as per screenshot). |
I've started using the v2 (2.10.0). Lots of improvements have been made from v1. This post is a feature request for being able to break config inheritance.
Below is an example config of what it might look like for a typical group.
With the above config, the project
my-group/special-private-project
gets members from the common settings (configured inmy-group/*
section) in addition to what's configured in that project directly.I think it makes sense that this is how it works by default. It'd be nice if I could specify in that project specific config to not inherit common settings so that I could manage "exception" scenarios. In the above example, I want to break the inheritance of the
members
section only but inherit other settings. I guess it could be perceived that someone might want to break the inheritance in other areas/sections as wellRight now my work-around is following. Only problem with this work-around is that I need to list out every single project in the config just so that I could have exception for a single project. So, I'm not able to take full advantage/power of gitlabform's config.
The text was updated successfully, but these errors were encountered: