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

fix: semantic versioning does not care about -dev so lets use -alpha #300

Merged
merged 1 commit into from
Apr 12, 2022

Conversation

mariux
Copy link
Contributor

@mariux mariux commented Apr 11, 2022

@katcipis
Copy link
Contributor

katcipis commented Apr 11, 2022

The go-version lib doesn't implement strict semver, specially the constraint logic since according to them is not specified on the spec. You can check in details here:

hashicorp/go-version#35 (comment)

"This lib doesn't strictly follow semver so it wouldn't be unprecedented to merge, just curious"

a version that is 2.0.0-alpha will only be accepted on a constraint when it is compared to 2.0.0-<pre-release>, any other version comparison will fail the constraint and that is expected when using this lib + constraints logic. So changing the semver pre-release segment to -alpha will not fix anything AFAIK.

I suppose this is also the terramate behavior, since it is a hashi lib.

Overall me and @i4ki were kind puzzled by this, they say that the spec doesn't say anything about constraints, but the spec is very clear about ordering, so when I declare a constraint I suppose it will be applied on the ordering defined on the spec, but it doesn't in the end x_x

ps. bonus round with more puzzled people: hashicorp/go-version#59

@mariux mariux marked this pull request as ready for review April 12, 2022 12:31
@mariux
Copy link
Contributor Author

mariux commented Apr 12, 2022

@katcipis whats your take on fixing this then?

terraform uses -alpha and it works.. so if they use the same lib... it should work? i would sya at least worth a try...

@katcipis katcipis self-requested a review April 12, 2022 13:04
@katcipis
Copy link
Contributor

Terraform itself uses -dev: https://github.com/hashicorp/terraform/blob/8040dfec3467d9dca7561d944ff9642bd0699ff0/version/version.go#L19

Didn't find anything on the go-version lib that handles alpha specially, if that works on terraform it would be some extra logic on terraform itself 🤔 ...or maybe I missed something. @i4ki and dug throught eh go-version lib, WDYT ?

@mariux mariux merged commit c91e449 into main Apr 12, 2022
@mariux mariux deleted the mariux/alpha branch April 12, 2022 13:28
@i4ki
Copy link
Contributor

i4ki commented Apr 12, 2022

I didn't find any special handling in the terraform version check code as well.
🤔

@katcipis
Copy link
Contributor

katcipis commented Apr 12, 2022

Some local testing that @i4ki did:

$ terramate list
2022-04-12T14:15:09+01:00 FTL  error="version check error: version constraint \"~> 0.0.11\" not satisfied by terramate version \"0.0.13-alpha\"" action=cli.checkVersion() root=/home/i4k/src/mineiros/tm-example2
$ cat terramate.tm
terramate {
	config {
	}
	required_version = "~> 0.0.11"
}

Just to confirm, this is the scenario that is supposed to work by using -alpha instead of -dev ? I doesn't seem like it is going to work 🤔

mariux added a commit that referenced this pull request Apr 12, 2022
katcipis pushed a commit that referenced this pull request Apr 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants