Skip to content
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

(Gitlab) Repo configuration should inherit Global configuration #248

Open
xNok opened this issue Jul 21, 2023 · 3 comments
Open

(Gitlab) Repo configuration should inherit Global configuration #248

xNok opened this issue Jul 21, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@xNok
Copy link

xNok commented Jul 21, 2023

Is your feature request related to a problem? Please describe.
The config at least should be inherited from a global configuration because those will most likely be shared actors repositories such as the user_mapping used to fix user auto-discovery.

config:
  user_mapping:

The second use case I see for inheritance is to have a global list of people on vacation so they can be rejected from the review selection.

Describe the solution you'd like
In the GitLab setup, we have to define a dedicated repo, cm that contains the Gitlab CI pipeline for the repo. We also have the option to define a global automation configuration. Any repo configuration should be able to inherit the global configuration.

Describe alternatives you've considered
Copy pasting

Additional context
This solution should simply require loading the global and repo configuration and applying a deep merge between both configurations. You can think of more advanced solutions such as includes or patches, but a simple (deep merge) inheritance would already cover a lot of use cases.

@xNok xNok added the enhancement New feature or request label Jul 21, 2023
@vim-zz vim-zz added bug Something isn't working and removed enhancement New feature or request labels Jul 26, 2023
@vim-zz vim-zz closed this as completed Jul 26, 2023
@vim-zz vim-zz added enhancement New feature or request and removed bug Something isn't working labels Jul 26, 2023
@vim-zz vim-zz reopened this Jul 26, 2023
@BenLloydPearson
Copy link
Collaborator

Thanks for proposing this idea @xNok! This feature isn't on our roadmap, but that may change, and we'll let you know if this gets prioritized.

In the meantime, it might be possible to partially workaround this problem by defining your automations at the GitLab Group level. You would still be restricted to a single user_mapping per automation, but you could at least make them apply to all repos. Let me know if you have questions about this.

@BenLloydPearson
Copy link
Collaborator

@xNok Would something like what is proposed in #226 solve your problem? We like this idea, but it adds quite a bit of complexity to how gitStream processes automations, so it would be a fairly significant effort for us.

Another possible workaround I want to propose in the meantime is to condense your automations down to a single file so that you only need to define your user_mapping once. It has the potential to lead to a massive file if you have a lot of automations, but gitStream is designed to handle that.

@xNok
Copy link
Author

xNok commented Jul 26, 2023

It is about the same, but an include feature seems more complex to implement. Simply having the deepmerge option would cover most of the cases. As far as I know, you are already merging all .cm files together.

You can configure gitStream via one or more Continuous Merge (CM) files inside your git repository or GitHub/GitLab organization. These files end with a .cm extension, and they outline automation that will run whenever someone opens a new PR or makes changes to an existing PR.

ref: https://docs.gitstream.cm/how-it-works/

So far I can have multiple cm files in the same repo, and they are merged according to the doc. I am simply expecting the global cm file to be merged with the local ones.

cm repo (for gitlab)

+ .cm
| `- user-mapping.cm
|   - default-automation.cm 
- .gitlab-ci-yml

repo (code repos)

+ .cm
 `- gitstream.cm

The resulting configuration is the combination of all three files as expected in the Github setup when breaking the configuration into multiple files.

nothing more than a deepmerge between a set of yaml file:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants