Fix darwin arch regex forces amd64 for some versions with arm64 available #403
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The regexes currently in master (from #351, but not yet released) fix all cases where tfenv cannot install because arm64 is unavailable. However, they occasionally force tfenv to install the amd64 binary for some of the >1.0.2 versions.
First,
0\..+$
matches any value containing0.
, including versions with arm64 builds (e.g.1.0.3
).The
1\.0\.0|1$
regex would also match1.5.0-beta1
(but not1.5.0-beta2
),1.10.1
, or anything else that starts with1.
, contains a0
, and then ends with a1
. I believe this regex was intended to be written as^(1\.0\.0|1)$
or^1\.0\.0$|^1$
. It seems more readable to just use^1\.0\.[0-1]$
. I couldn't find any-beta
or-rc
releases of1.0.0
or1.0.1
, so this should be safe.You can test this behavior with some bash
The new regex seems to fix all of these cases:
You can also test this against all versions of terraform tfenv sees:
They all look correct to me