tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

Add `latest-allowed` option from required_version

Open OJFord opened this issue 4 years ago • 9 comments

This commit adds an option similar to min-required in that it parses the terraform's required_version, but then uses the most recent version allowed by that spec.

For example, given:

required_version = "~> 0.10.0"

min-required would give us 0.10.0, while latest-allowed will give us 0.10.8 (via latest:^0.10).

The < operator is not implemented (only > >= ~> <=) because it's messy to find the latest version smaller than a given one in list-remote's output, given it may not (yet) exist, and it seems a reasonably assumption/requirement that the version numbers will exist, since, for example:

required_version = "~> 1.0"

expresses the same as:

required_version = "< 2.0.0"

without requiring a version that doesn't (at time of writing) exist.

This assumption/requirement stands for <= too, but again I think that's reasonable since <= 2.0.0 (as opposed to not equal to) seems like a strange version constraint to use before it exists. (And when it does, one can just use 2.0.0.)

Closes #307.

OJFord avatar Nov 12 '21 18:11 OJFord

Is it planned to continue this?

e-power avatar Feb 14 '22 10:02 e-power

@e-power I am here, and able to make any requested changes, yes.

The maintainers seem to have other priorities at the moment though, no commits for six months & some PRs awaiting review.

OJFord avatar Feb 14 '22 12:02 OJFord

Actually, I just saw there was a release a few days ago. Note the comments there: https://github.com/tfutils/tfenv/releases/tag/v2.2.3

OJFord avatar Feb 14 '22 13:02 OJFord

@OJFord we would also really like this feature! May i ask you to rebase the branch so merging is easier for the maintainers :)?

smelchior avatar Apr 28 '22 14:04 smelchior

@smelchior Done, there weren't actually any conflicts, GitHub's warning was just that it was 'out of date', i.e. there was a commit ('update changelog') on master not on this branch.

I don't think that's what was holding this back though, I wouldn't hold your breath for any merges! Let me know if you run tfenv from this branch / with this patch and run into any issues in the meantime.

@Zordrak Obviously I'm biased by my own PRs, but those aside if you need any help maintaining tfenv, and issue triage etc. I'd be happy to help.

OJFord avatar Apr 30 '22 10:04 OJFord

Hi! Good to hear from you. Sure, I'll look into it.

OJFord avatar Jul 08 '22 20:07 OJFord

I would still really like to see this PR merged, is there something still open I could assist with :)?

smelchior avatar Sep 01 '22 07:09 smelchior

Thanks @smelchior, so would I (and I'm still here and willing to work on this too fwiw 🙂).

I think I added a passing test as was requested, so good to go from my perspective.

If you could (if you're not already) use this branch to test it out manually though I'm sure any feedback (whether you have issues or not) would be appreciated.

OJFord avatar Sep 01 '22 20:09 OJFord

Thanks @OJFord i already did some tests on my side and it works as advertised :) Very nice feature which reduces the hassle of updating the version in 2 places when there is an update!

smelchior avatar Sep 08 '22 05:09 smelchior

Thanks for merging this @Zordrak, that will really help our workflow :) Do you have an estimate when a new release will be made including this feature?

smelchior avatar Oct 04 '22 14:10 smelchior

@Zordrak please release it 🙏

mputilin avatar Nov 08 '22 18:11 mputilin

@Zordrak any timeline to release this change along with the other commits that were merged in?

Seems like the community (including myself) would be happy to help as well with anything to get this distributed so let us know what we can help with.

jlestrada avatar Apr 28 '23 19:04 jlestrada

Do you have any news when this feature will be released, @Zordrak? :)

timo-reymann avatar Jun 16 '23 10:06 timo-reymann