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

Action fails to install semver exact match or constraint prerelease go version #191

Closed
5 tasks done
mkungla opened this issue Feb 18, 2022 · 11 comments
Closed
5 tasks done
Assignees
Labels
bug Something isn't working

Comments

@mkungla
Copy link

mkungla commented Feb 18, 2022

Description:

Documentation states that semver prerelease can be installed, but action fails with following error.

Unable to find Go version '1.18.0-rc1' for platform linux and architecture x64.

As @dmitry-shibanov pointed out in hes comment #191 (comment) using stable: false works. However when action@v2 claims to be Semver compliant on parsing versions as clearly stated in README then it SHOULD NOT be expected to require additional configuration flag. Version parsing and handling SHOULD then expected fully be handled by Semver constraints.

There are 2 options either to fix this:

  1. either deprecate stable flag and follow fully Semver version comparisons constraint parsing principles.
  2. or remove emphasized Semver reference and since current implementation takes only Semver version syntax without following actual specs then it should rather just state about version number format.

Working With Prerelease Versions

A pre-release version indicates that the version is unstable and might not satisfy the intended compatibility requirements as denoted by its associated normal version.

SemVer comparisons using constraints without a prerelease comparator will skip prerelease versions. For example, >=1.2.3 will skip prereleases when looking at a list of releases while >=1.2.3-0 will evaluate and find prereleases.

The reason for the 0 as a pre-release version in the example comparison is because pre-releases can only contain ASCII alphanumerics and hyphens (along with . separators), per the spec. Sorting happens in ASCII sort order, again per the spec. The lowest character is a 0 in ASCII sort order.


And in node semver package: Prerelease Tags

If a version has a prerelease tag (for example, 1.2.3-alpha.3) then it will only be allowed to satisfy comparator sets if at least one comparator with the same [major, minor, patch] tuple also has a prerelease tag.
...
For example, the range >1.2.3-alpha.3 would be allowed to match the version 1.2.3-alpha.7, but it would not be satisfied by 3.4.5-alpha.9, even though 3.4.5-alpha.9 is technically "greater than" 1.2.3-alpha.3 according to the SemVer sort rules. The version range only accepts prerelease tags on the 1.2.3 version. The version 3.4.5 would satisfy the range, because it does not have a prerelease flag, and 3.4.5 is greater than 1.2.3-alpha.7.

The purpose for this behavior is twofold. First, prerelease versions frequently are updated very quickly, and contain many breaking changes that are (by the author's design) not yet fit for public consumption. Therefore, by default, they are excluded from range matching semantics.

Second, a user who has opted into using a prerelease version has clearly indicated the intent to use that specific set of alpha/beta/rc versions. By including a prerelease tag in the range, the user is indicating that they are aware of the risk. However, it is still not appropriate to assume that they have opted into taking a similar risk on the next set of prerelease versions.

as conclusion e.g. config which currently fail, while they are expected to succeed

# exact version should always be respected
with:
      go-version: '1.18.0-rc1'
      # ERROR: Unable to find Go version '1.18.0-rc1' for platform linux and architecture x64.
      # with stable: false 
      # go version go1.18rc1 linux/amd64
# exact version should always be respected
with:
      go-version: '>=1.18.0-beta2'
      # ERROR: Unable to find Go version '>=1.18.0-beta2' for platform linux and architecture x64.
      # 
      # with stable: false
      # go version go1.18rc1 linux/amd64

Action version:

actions/setup-go@v2

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

1.18.0-rc1

Repro steps:

https://github.com/mkungla/github-cicd/runs/5246697691?check_suite_focus=true

Expected behavior:

1.18.0-rc1 to be installed as defined in matrix
https://go.dev/dl/?mode=json&include=all has 1.18

{
    "filename": "go1.18rc1.linux-amd64.tar.gz",
    "os": "linux",
    "arch": "amd64",
    "version": "go1.18rc1",
    "sha256": "9ea4e6adee711e06fa95546e1a9629b63de3aaae85fac9dc752fb533f3e5be23",
    "size": 141635175,
    "kind": "archive"
},

Actual behavior:

workflow fails to install go1.18rc1

@mkungla mkungla added bug Something isn't working needs triage labels Feb 18, 2022
mkungla added a commit to cardano-community/koios-go-client that referenced this issue Feb 18, 2022
Signed-off-by: Marko Kungla <marko.kungla@gmail.com>
@dmitry-shibanov
Copy link
Contributor

Hello @mkungla. Thank you for your report. Could you please try to use this snippet:

    - name: Setup Go
      uses: actions/setup-go@v2
      with:
        go-version: 1.18.0-rc1
        stable: false

@mkungla mkungla changed the title Action fails to install semver prerelease go version Action fails to install semver (exact match) prerelease go version Feb 18, 2022
@mkungla
Copy link
Author

mkungla commented Feb 18, 2022

@dmitry-shibanov I clarified and edited my comment

@mkungla mkungla changed the title Action fails to install semver (exact match) prerelease go version Action fails to install semver exact match or constraint prerelease go version Feb 18, 2022
@mvdan
Copy link

mvdan commented Mar 3, 2022

@dmitry-shibanov I think this is fixed, as stable is now removed in v3, but the RC example in the README is incorrect. It suggests that a version like 1.18.0-rc1 would work, when in fact one needs 1.18.0-rc.1 as described in the v3.0.0 release. Please update the docs :)

@tliron
Copy link

tliron commented Mar 7, 2022

The v3 docs say that semver ranges are supported, but I can't get any of these to work:

>=1.18
>=1.18.0
>=1.18.0-rc1
>=1.18 || 1.18.0-rc1

I'm trying to do something rather simple: support everything from 1.18rc1 and onward. Is this possible?

@tliron
Copy link

tliron commented Mar 7, 2022

OK, this seems to work:

>=1.18.0-rc.1

:)

@mlcdf
Copy link

mlcdf commented Mar 9, 2022

@tliron I must have missed something then because using >=1.18.0-rc.1 does work on my project:
image

@tliron
Copy link

tliron commented Mar 9, 2022

@mlcdf Use actions/setup-go@v3

@mlcdf
Copy link

mlcdf commented Mar 9, 2022

Oh, I missed that part, thank you very much! It works!

@tliron
Copy link

tliron commented Mar 9, 2022

The README file still shows v2. I will open an issue for that.

@mkungla
Copy link
Author

mkungla commented Mar 11, 2022

this can be closed wehen merging #202 seems that in general this issue is resolved

@vsafonkin
Copy link

Hi @mkungla, I'm going to close this issue cause the docs were updated. Feel free to contact as if you have any questions, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants