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

docs: versioning should not be combined with matchUpdateTypes #17220

Merged
merged 4 commits into from Aug 17, 2022

Conversation

colinodell
Copy link
Contributor

@colinodell colinodell commented Aug 16, 2022

Changes

Documents an edge case that may produce unexpected results for users.

Context

We had a user create a packageRule like this:

{
  "matchManagers": ["maven", "gradle"],
  "matchUpdateTypes": ["patch"],
  "versioning": "regex:^(?<major>\\d+)(\\.(?<minor>\\d+))?(\\.(?<patch>\\d+))?([-\\.](?<compatibility>.*))?$",
  "groupName": "jvm-patch-with-compatibility"
}

With this rule in place, Renovate opened a PR tying to upgrade a Maven dependency from 9.4.1.jre8 to 9.4.1.jre16 as a patch update, which was unexpected to them.

After debugging, we confirmed that the custom versioning never took effect because of a chicken-and-egg problem. Basically, Renovate tries to apply package rules several times at different points in time, like:

  1. Before fetching all available packages, to figure out which versioning scheme to use throughout the rest of the dependency update process
  2. While considering what to do (if anything) for each available dependency release

That first time, it skipped the user's rule because it said it only applied to patch-level updates, but Renovate didn’t yet have that information to match against. That meant the versioning was never applied in "step 1", so it fell back to its default Maven handling. Then, when it had all the available versions in "step 2", it saw that Maven considered those to be patch releases, so the rule kicked in at that point, but it was too late for the versioning to do anything (so it only applied the grouping stuff).

It would therefore be helpful to document that rules defining the versioning should not also define matchUpdateTypes to avoid this behavior. (Splitting the rule into two - one for versioning and another for grouping - fixed this for the user.)

Alternatively, it might be useful to raise some kind of proactive warning if a user configures both versioning and matchUpdateTypes in the same rule, but I figured documenting this limitation wouldn't hurt.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please tick one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@colinodell colinodell changed the title Document that versioning should not be combined with matchUpdateTypes docs: versioning should not be combined with matchUpdateTypes Aug 16, 2022
rarkins
rarkins previously approved these changes Aug 17, 2022
@rarkins rarkins enabled auto-merge (squash) August 17, 2022 06:00
docs/usage/modules/versioning.md Outdated Show resolved Hide resolved
rarkins and others added 2 commits August 17, 2022 09:56
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
@rarkins rarkins merged commit 275ef41 into renovatebot:main Aug 17, 2022
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 32.162.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@colinodell colinodell deleted the patch-1 branch August 18, 2022 15:14
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants