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 version ranges for non-semver #34

Merged
merged 1 commit into from
May 14, 2021
Merged

Fix version ranges for non-semver #34

merged 1 commit into from
May 14, 2021

Conversation

paulo-ferraz-oliveira
Copy link
Collaborator

This is an attempt at trying to understand why OTP 24 is not available yet. Opening as a draft as most likely this investigation will result is a closed-unmerged branch.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

paulo-ferraz-oliveira commented May 12, 2021

Hm...

  • semver.validRange('24') returns '>=24.0.0 <25.0.0-0', which is seemingly Okay (24 is the input spec),
  • semver.maxSatisfying(['24.0'], '>=24.0.0 <25.0.0-0') returns null, which is not usable (24.0 is the value found in the Hex.pm listing).

Some might say semver is wrong, here.

Thoughts on how to solve this?

Edit: I tried update semver (npm dep. but this is still no good).

@paulo-ferraz-oliveira
Copy link
Collaborator Author

Lets try with 24.0, instead of 24: 51e8d2f.

@@ -98,6 +98,10 @@ jobs:
otp-version: '23'
rebar3-version: '3.14'
os: 'ubuntu-20.04'
- elixir-version: 'v1.12'
otp-version: '24.0'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to not be the best option. Waiting for input.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

Moving from Draft, for visibility. Not merge-ready yet.

@ericmj
Copy link
Collaborator

ericmj commented May 12, 2021

OTP 24 is not available because Bob has not built it yet. There seems to be a regression in OTP 24 that causes the compilation to fail.

@ericmj
Copy link
Collaborator

ericmj commented May 12, 2021

OTP 24 is not available because Bob has not built it yet. There seems to be a regression in OTP 24 that causes the compilation to fail.

It seems it only fails for Docker images, so the issue is unrelated.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

@ericmj, I've tracked it down to this being a semver (npm package) issue. We either:

  • force 24 to be 24.0 (e.g. in a hacks module), or
  • we create a more generic rule (e.g. x becomes x.0), or
  • we fix semver, or
  • we find an alternative to semver.

I'd prefer to not fiddle with our code, since its assumptions are correct, and either find an alternative to semver or open an issue to fix it. I'll start be opening the issue, but accept thoughts 😄

@paulo-ferraz-oliveira
Copy link
Collaborator Author

Bug opened: npm/node-semver#382.

@ericmj
Copy link
Collaborator

ericmj commented May 13, 2021

I don't believe it's a bug in the semver package but rather that OTP versions are not semver. 24.0 is not valid semver so it's understandable that semver.maxSatisfying does not accept it.

We could try to convert 24.0 => 24.0.0 so that the value is accepted.

Personally I don't think we should support version ranges because CI should be reproducible and automatically updating versions are not reproducible but I guess we need to maintain the backwards compatibility. Did this work before the setup-beam rewrite?

@paulo-ferraz-oliveira
Copy link
Collaborator Author

I don't believe it's a bug in the semver package but rather that OTP versions are not semver. 24.0 is not valid semver so it's understandable that semver.maxSatisfying does not accept it.

Understandable, yes; that it won't/shouldn't accept it... I'm still waiting for a reply to the issue.

Personally I don't think we should support version ranges because CI should be reproducible

Agree almost completely; this is from the "setup-elixir" times. We offer this flexibility for people who don't care about repeatability (I guess!), also, and because otherwise this action could just be a couple of bash scripts.

and automatically updating versions are not reproducible

That's the main issue I have with the ranges (non-reproducibility). At the same time, some will use branches in their dependencies, which also break this promise, but on our end, not supporting ranges could be an extra safety net.

but I guess we need to maintain the backwards compatibility

We don't need to. As per semver we just go 2.x (and add some kind of release note) and that's it 😄

Did this work before the setup-beam rewrite?

Most surely not, as per https://github.com/actions/setup-elixir/blob/main/src/setup-elixir.js#L104, which was left untouched, algo-wise.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

paulo-ferraz-oliveira commented May 13, 2021

I find that semver.minVersion(spec).version for spec=24 returns 24.0.0, as well as for spec=24.0, so I'm going with that, for now.

Mind you I changed the 24.0 in the tests back to 24 to test this particular change.

Edit: breaks for e.g. 19.3.x
Edit: I'm going to try with this loose option. Mind you the README already makes the following explicit: "For best results, we recommend specifying exact Erlang/OTP, Elixir versions, and rebar3 versions"

@paulo-ferraz-oliveira paulo-ferraz-oliveira changed the title Try to understand why 1.7.0 is failing on elli-lib Fix version ranges for non-semver May 13, 2021
@paulo-ferraz-oliveira
Copy link
Collaborator Author

I've squash-rebased all of this. Waiting for approval and merging...

@@ -184,7 +184,10 @@ async function getOTPVersions(osVersion) {
.forEach((line) => {
const otpMatch = line.match(/^(OTP-)?([^ ]+)/)

const otpVersion = otpMatch[2]
let otpVersion = otpMatch[2]
if (semver.validRange(otpVersion)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@starbelly, @ericmj, @wojtekmach, could I ask your 👀 on this so we can merge it and ship 1.7.1? I'd want to pull this to a couple of repo.s, already. Thanks much.

If you have a better, even less verbose for example, "fix", do tell. I'd like to potentially consider dropping the ver-ranges, but not in this pull request.

@paulo-ferraz-oliveira
Copy link
Collaborator Author

I pushed some more tests for the newly introduced code based on no-longer maintained versions (so it won't easily break in a near future).

@paulo-ferraz-oliveira paulo-ferraz-oliveira merged commit a550a4c into erlef:main May 14, 2021
@paulo-ferraz-oliveira paulo-ferraz-oliveira deleted the test-with-some-recent-versions branch May 14, 2021 23:07
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