question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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 https://github.com/actions/setup-go/issues/191#issuecomment-1044049818 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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tlironcommented, Mar 9, 2022

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

0reactions
vsafonkincommented, Mar 30, 2022

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm - Does caret (^) in semver matches pre-release when pre ...
Typically a range with a caret ( ^ ) prefix such as ^1.0.0 does not result in the prerelease version 1.1.0-prerelease being installed....
Read more >
FAQ.md - golang/dep - Sourcegraph
How do I change the version of a dependency? Can I put the manifest and lock in the vendor directory? How do I...
Read more >
Semantic Versioning Sucks! Long Live Semantic Versioning
Strict constraint (or fully qualified constraint) are those constraints matching only one version. In most cases it is a bad idea to use...
Read more >
Helm Search Repo
If you want to search using a version constraint, use --version. Examples: # Search for stable release versions matching the keyword "nginx" $...
Read more >
Publishing Extensions - Visual Studio Code
Note: Due to security concerns, vsce will not publish extensions that ... Users can choose to install pre-release versions of extensions in VS...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found