Wrong changelog content when updating different dependencies that come from the same repository #36939
Unanswered
stekern
asked this question in
Request Help
Replies: 4 comments
This comment was marked as spam.
This comment was marked as spam.
This comment has been hidden.
This comment has been hidden.
|
@zharinov could you take a look at the caching issue? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
How are you running Renovate?
A Mend.io-hosted app
If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.
GitHub
Please tell us more about your question or problem
Problem
I have a monorepo (a library of sorts) containing releases for many different dependencies. Releases point to tags that follow the naming convention
<dependency-name>-v<version>(e.g.,example-v1.0.0,another-v1.0.0, etc.) to separate them.In consuming repositories I am using a custom Regex manager to keep these dependencies updated. For the most part this works quite nicely, but I've noticed that sometimes the changelog content in the PRs created by Renovate for these dependencies include entries from other dependencies in the monorepo. As an example, the changelog for upgrading dependency
examplefromv1.0.0tov1.0.1includes a changelog entryv1.0.1that actually belongs to theanotherdependency.Reproduction
This was tricky to troubleshoot as I couldn't find anything useful in the (debug) logs, but I've finally managed to create a minimal reproduction. It seems to come down to cache key collisions, and these are the conditions that seem to trigger it:
packageName)These conditions will lead to the dependency being processed first (e.g.,
another) "poisoning" the cache that is later used by another dependency (e.g.,example).See the following for a minimal reproduction repository that functions both as an example monorepo containing multiple dependencies, and as a consumer of the same dependencies: https://github.com/stekern/renovate-repro-monorepo-changelog-issue.
Notice that the PR for updating the
exampledependency contains the wrong changelog content stekern/renovate-repro-monorepo-changelog-issue#2.I've reproduced this both in the hosted and self-hosted version (through GitHub Actions).
Potential root cause
There might be other mechanisms behind the behavior, but I've found at least two methods that seem to explain some of it. The following cache keys set by Renovate are not unique per dependency in a monorepo, causing collisions when versions overlap for different dependencies in the same repository:
${repository}:${version}(or${repository}:${sourceDirectory}:${version}ifsourceDirectoryis set)${sourceUrl}:${packageName}:${prev}:${next}Mitigations
I've discovered two imperfect workarounds that involve using the
sourceDirectoryconfiguration option to:"sourceDirectory": "{{depName}}")"sourceDirectory": "cache-key-{{depName}}"). Since this directory does not exist in the source repository, it seems to fall back to using release notes which are then cached under a unique key.Both of these workarounds give me PRs with correct changelog entries, but the
Compare Sourcelinks are still wrong - presumably because they come from the cache layer ingetChangeLogJSON(). I tried to come up with a similar workaround for fixing the links, but the only somewhat feasible way I could think of without breaking anything else seemed to be modifying thesourceUrlby adding a unique number of trailing slashes (which are later stripped out) per dependency to get a unique cache key. But that feels very, very wrong.Is the behavior I've described here expected? If so, is this something you would consider implementing support for? I haven't had other issues with monorepos in Renovate, so it's already very functional. It's also a somewhat common way to organize dependencies. Naively I think having
depNameas part of all relevant caching layers would solve the issue, but that might have other side effects. Alternatively the ability to turn off caching (e.g., for specific operations, repositories and/or dependencies) might also be a solution, but that might not be an ideal way to go.Logs (if relevant)
Logs
All reactions