tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

fix: filter out Artifactory version & sort versions

Open samuel-phan opened this issue 1 year ago • 5 comments

fix #400 #401

samuel-phan avatar Jun 15 '23 17:06 samuel-phan

@Zordrak any chance that this PR can be reviewed? We're also running into issue #400, and this PR looks to resolve it.

fcatacut avatar Jul 24 '23 17:07 fcatacut

We running into the same issue, would it be possible to merge this?

fbritoferreira avatar Sep 28 '23 17:09 fbritoferreira

The p flag for the s command of sed is meant to display the changed line, it doesn't seem possible to exclude the artifactory line and retrieve the version on other line in one command. So if you want to do it with one sed call, you should use two commands :

sed -En -e 's#.*[A-Za-z]+/([0-9]+\.[0-9]+\.[0-9]+(-(rc|beta|alpha|oci)-?[0-9]*)?).*##' -e 's#.*([0-9]+\.[0-9]+\.[0-9]+(-(rc|beta|alpha|oci)-?[0-9]*)?).*#\1#p'

That did not remove duplicates, and i am not sure that will be more readable than the use of two grep calls.

Changing the showed line 77 in the PR with grep -v -E "[A-Za-z]+/[0-9]+\.[0-9]+\.[0-9]+ wouldn't be enough to make it more generic ?

dvaumoron avatar Oct 02 '23 08:10 dvaumoron

the errors seems to be linked to https://github.com/golang/go/issues/49425

dvaumoron avatar Oct 04 '23 10:10 dvaumoron

the first go version without this bug is the 1.11, the first terraform release with 1.11+ compatibility instead of 1.10+ is the 0.11.9, i will upgrade the tests accordingly

dvaumoron avatar Oct 04 '23 15:10 dvaumoron