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

supporting rangeStrategy=update-lockfile with mix manager #13618

Closed
roelandvanbatenburg opened this issue Jan 18, 2022 · 24 comments · Fixed by #27915
Closed

supporting rangeStrategy=update-lockfile with mix manager #13618

roelandvanbatenburg opened this issue Jan 18, 2022 · 24 comments · Fixed by #27915
Assignees
Labels
auto:no-mentions Don't cause unnecessary notifications help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@roelandvanbatenburg
Copy link

What would you like Renovate to be able to do?

We use ranges in our mix.exs and then have specific versions in mix.lock. We would live renovate to update mix.lock when a newer version is available (currently it only updates when mix.exs needs to be updated).

See #13616 (comment) for more details

If you have any ideas on how this should be implemented, please tell us here.

Something similar to #3108

Is this a feature you are interested in implementing yourself?

Maybe

@roelandvanbatenburg roelandvanbatenburg added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality) labels Jan 18, 2022
@rarkins
Copy link
Collaborator

rarkins commented Jan 18, 2022

@rarkins rarkins added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:ready auto:reproduction A minimal reproduction is necessary to proceed and removed priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels Jan 18, 2022
@renovatebot renovatebot deleted a comment from github-actions bot Jan 18, 2022
@rarkins rarkins added reproduction:provided and removed auto:reproduction A minimal reproduction is necessary to proceed labels Jan 18, 2022
@jimsynz
Copy link

jimsynz commented Feb 23, 2022

Happy to help if needed.

@viceice viceice added the help wanted Help is needed or welcomed on this issue label Feb 23, 2022
@epinault
Copy link

epinault commented Oct 4, 2023

any update on this? I just got into this issue as well as the one around having to pin an application exactly and was wondering how are people using it for libaries in Elixir. This makes it difficult to adopt renovate which I really like

@jimsynz
Copy link

jimsynz commented Oct 4, 2023

I took a look at the code but honestly I couldn't make heads nor tails of it. If anyone has any pointers on how to make it work I'll happily work up a PR.

@rarkins
Copy link
Collaborator

rarkins commented Oct 5, 2023

First step we could get help on is: does mix have a command where you can tell it to update a locked version of a dependency to a specific version?

e.g. let's say the package file has a range like 1.x and the lock file is on 1.1.0. Let's also say versions 1.2.0 and 1.3.0 exist, and we want to update specifically to 1.2.0. Is there a command which lets us either (a) update specifically to 1.2.0, or (b) at least update to the latest matching version, which is 1.3.0?

Alternatively, is the mix lock file simple enough that we could patch/modify the lock file directly ourselves?

@roelandvanbatenburg
Copy link
Author

does mix have a command where you can tell it to update a locked version of a dependency to a specific version?

mix deps.update --target <deps> will update to the latest version allowed by mix.exs. I don't think option (a) exists.

@epinault
Copy link

epinault commented Oct 5, 2023

you could also find outdated one with mix hex.outdated and for a spcifci package and its dependencies mix hex.outdated mypackage

@jimsynz
Copy link

jimsynz commented Oct 5, 2023

@rarkins the mix.lock file format is reasonably easy to parse, as it is an Elixir term.

I did a bit of a dive into the Mix.Dep.* source and there's no capability to specify the version during convergence (what mix calls dependency resolution). It could be patched to let you provide a replacement requirement on the command line but my gut feeling is that a PR for that would be rejected, since we can already specify the requirement in the mix.exs.

I can see two possible courses of action:

  1. Pin the dependency in mix.exs temporarily (ie change the requirement to "== <version>") while running mix deps.get <dep> and then undoing the change, or
  2. Edit the version directly in mix.lock and run mix.deps.get - you don't have to worry about the rev, it will be updated by mix deps.get. This method won't work if there are transitive dependencies that also need to be updated, but mix deps.update <dep> will do the correct thing in that case.

@epinault
Copy link

@rarkins do you know if someone has time to look at it? or started to tackle it?

@rarkins
Copy link
Collaborator

rarkins commented Oct 24, 2023

No, this is awaiting a community PR

@pdm-jd
Copy link
Contributor

pdm-jd commented Dec 6, 2023

I have a working version in this branch. I need to fix some tests and see if there are any edge cases for our use cases before creating a PR. @roelandvanbatenburg if you want to try it out that would be helpful.

This is the repo I've been working off of https://github.com/pdm-jd/renovate-mix-tests/pulls. These are the PRs created from using the update-lockfile strategy. It also works with the in-range-only strategy, but does not create the major version PR.

image

@jimsynz
Copy link

jimsynz commented Feb 22, 2024

@pdm-jd this looks awesome. do you think it's ready for a PR back to renovate?

@epinault
Copy link

it's almost ready to share @jimsynz

@pdm-jd
Copy link
Contributor

pdm-jd commented Mar 13, 2024

Alright, posted the PR @jimsynz. Can you give it a shot and let me know if it works for you?

@jimsynz

This comment has been minimized.

@jimsynz
Copy link

jimsynz commented Mar 13, 2024

@pdm-jd so I just blew up my local Forgejo instance with it and it worked nicely. I now have hundreds of PR's 😂.

There were errors wherever the version requirement had an infix operator in it, for example: https://harton.dev/cinder/cinder/pulls/38

Once that's fixed I think this will work flawlessly.

@pdm-jd
Copy link
Contributor

pdm-jd commented Mar 13, 2024

@jimsynz that's actually an issue with how the existing hex versioning code works. It translates from hex to npm to figure out what the next version is then back to hex.

I'll fix it :)

@pdm-jd
Copy link
Contributor

pdm-jd commented Mar 13, 2024

Actually, I don't know if the simple change I made will actually resolve the issue. I'd prefer it to not block the change.

Would you be able to move to >= 2.0.1 and < 3.0.0? It seems to be the same as ~> 2.0 and >= 2.0.1 and looks to be supported out of the box by renovate.

versions = ["2.0.0", "2.0.1", "2.1.0", "2.2.5", "3.0.0"]
for version <- versions, do: Elixir.Version.match?(version, ">= 2.0.1 and < 3.0.0")
# [false, true, true, true, false]
for version <- versions, do: Elixir.Version.match?(version, "~> 2.0 and >= 2.0.1")
# [false, true, true, true, false]

@jimsynz
Copy link

jimsynz commented Mar 13, 2024

will do.

@jimsynz
Copy link

jimsynz commented Mar 13, 2024

I also have a package like this ~> 2.0 or ~> 1.0 which I guess just means < 3.0.0. I'll change it.

@epinault

This comment was marked as spam.

@rarkins rarkins added the auto:no-mentions Don't cause unnecessary notifications label Mar 20, 2024
Copy link
Contributor

Hi there,

Please do not unnecessarily @ mention maintainers like @rarkins or @viceice. Doing so causes annoying mobile notifications and makes it harder to maintain this repository.

For example, never @ mention a maintainer when you are creating a discussion if your desire is to get attention. This is rude behavior, just like shouting out your coffee order in a Starbucks before it's your turn.

It's OK to comment in an issue or discussion after multiple days or weeks. But please, still don't @ mention people. The maintainers try to answer most discussions, but they can't answer all discussions. If you're still not getting an answer, take a look at the information you've given us and see if you can improve it.

Thanks, the Renovate team

@rarkins
Copy link
Collaborator

rarkins commented Mar 20, 2024

There is nothing to look at because the PR already has unaddressed review comments

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 37.405.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto:no-mentions Don't cause unnecessary notifications help wanted Help is needed or welcomed on this issue priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants