-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Support Generic Grouping Rules #11092
Comments
I've taken the liberty to put your JSON through Prettier, as that makes things easier to read/understand. 😉 {
"packageRules": [
{
"groupName": "{sourceUrl}",
"groupSlug": "{sourceUrl}"
},
{
"groupName": "{1}",
"groupSlug": "{1}",
"matchDatasources": ["npm"],
"matchSourceUrlPrefixes": ["^([^/]*)$", "^@([^/]*)/"]
}
]
} |
@kevincox I agree completely with this idea. I've had something similar my head for a long time but can't find any open issue so maybe I didn't write it down. In short, the biggest advantage we could deliver is "automatic" monorepo grouping like you point out, without the need for static definitions. But also there will be times where people want to group by "scope" (e.g. The way I envisioned this was having a new field like
In future it might look like this: This would mean "if the user has configured a groupName via packageRules, then use that. If not then use the package's source repo to group, or its scope/groupId, but finally fall back to If we migrate to this approach then it would mean:
|
The valid values for |
That approach looks good too. It is a bit more high level which is probably a good thing in this case. It also provides a nice preference order which solves the issue I outlined in my original proposal. I think scope is the same thing I meant when I said org. Scope is the NPM terminology but you get the same idea on the Docker Hub, GitHub... Homepage was part of making it generic. I don't know how commonly useful it would be compared to the repo so maybe it could wait until there is demand fond. One suggestion is just to use the names already used in the configuration. So: |
We just need to make sure it's clear which is the scope if e.g. it's an npm package
Using We use |
I imagine that that would depend on the package system. For NPM it would mean
Is the intention to parse out the org/repo from various source hosts? What about ones that don't have an "org" concept? What happens for unknown hosts? It would probably be better to have the grouping rely on the full |
Ultimately, grouping is based on branch name so your suggestion isn't feasible in our code base. The scenarios where you have an unknown host without a concept of org/repo structure is pretty easy to fall back to using a slugified version of the URL anyway (e.g. dropping the https:// at least). I don't believe in multiplying the time of features and complexity of the code base for edge cases which have a suitable workaround. |
Ah, I didn't realize that grouping and branch name were intrinsically linked. In that case it sounds reasonable to do as you proposed. |
What would you like Renovate to be able to do?
I would like to be able to tell Renovate to group packages based on rules such as the following:
This would allow obsoleting most of the monorepo rules while supporting more monorepos without further configuration.
Did you already have any implementation ideas?
Something similar to this would work. The key is the
groupSlug
item, it allows any packages which evaluate to the same key to be groups. Alternatively thegroupName
could be used but it may be useful to put something more readable in there.It isn't perfectly clear how these combine though. In this example you would have two candidate
groupSlug
s for each NPM package. One option is to merge on any match, but what if you match different packages with differentgroupSlug
s?The text was updated successfully, but these errors were encountered: