Skip to content

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

@mkungla

Description

@mkungla

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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions