Azure / setup-helm

Github Action for installing Helm
MIT License
141 stars 48 forks source link

Bug: Latest is incorrectly pulling last result in gh api release queries and not the latest release #98

Closed dwhitacre closed 2 years ago

dwhitacre commented 2 years ago

What happened?

Using the latest version in the helm action causes this code: https://github.com/Azure/setup-helm/blob/main/src/run.ts#L52 to attempt to lookup the latest release from the helm/helm github repo via the github graphql api. This api call limits the result set to 100, so once helm added more than 100 total releases, this fails to find the actual latest version. Currently it finds 1.2.1 which is quite an old helm version. (see api call log below)

This should be updated to correctly find the latest version by sorting the list via semver versioning rules using the entire result set (by pagination or using a larger than 100 number), OR better yet it should install the latest version using the script provided by the helm team listed in the docs here: https://helm.sh/docs/intro/install/

Version

Runner

self-hosted

Relevant log output

response from the api shows the latest version to be 1.2.1 according to the implementation here

gh api graphql -f query='{
               repository(name: "helm", owner: "helm") {
                  releases(last: 100) {
                     nodes {
                        tagName
                     }
                  }
               }
            }' | jq
{
  "data": {
    "repository": {
      "releases": {
        "nodes": [
          {
            "tagName": "v2.16.3"
          },
          {
            "tagName": "v2.16.2"
          },
          {
            "tagName": "v3.1.0-rc.3"
          },
          {
            "tagName": "v3.1.0-rc.2"
          },
          {
            "tagName": "v3.1.0-rc.1"
          },
          {
            "tagName": "v3.0.3"
          },
          {
            "tagName": "v3.0.2"
          },
          {
            "tagName": "v3.0.1"
          },
          {
            "tagName": "v3.0.0"
          },
          {
            "tagName": "v3.0.0-rc.4"
          },
          {
            "tagName": "v2.16.1"
          },
          {
            "tagName": "v3.0.0-rc.3"
          },
          {
            "tagName": "v2.16.0"
          },
          {
            "tagName": "v3.0.0-rc.2"
          },
          {
            "tagName": "v2.16.0-rc.2"
          },
          {
            "tagName": "v2.16.0-rc.1"
          },
          {
            "tagName": "v3.0.0-rc.1"
          },
          {
            "tagName": "v2.15.2"
          },
          {
            "tagName": "v2.15.1"
          },
          {
            "tagName": "v3.0.0-beta.5"
          },
          {
            "tagName": "v2.15.0"
          },
          {
            "tagName": "v2.15.0-rc.2"
          },
          {
            "tagName": "v2.15.0-rc.1"
          },
          {
            "tagName": "v3.0.0-beta.4"
          },
          {
            "tagName": "v3.0.0-beta.3"
          },
          {
            "tagName": "v3.0.0-beta.2"
          },
          {
            "tagName": "v3.0.0-beta.1"
          },
          {
            "tagName": "v2.14.3"
          },
          {
            "tagName": "v3.0.0-alpha.2"
          },
          {
            "tagName": "v2.14.2"
          },
          {
            "tagName": "v2.14.1"
          },
          {
            "tagName": "v3.0.0-alpha.1"
          },
          {
            "tagName": "v2.14.0"
          },
          {
            "tagName": "v2.14.0-rc.2"
          },
          {
            "tagName": "v2.14.0-rc.1"
          },
          {
            "tagName": "v2.13.1"
          },
          {
            "tagName": "v2.13.0"
          },
          {
            "tagName": "v2.13.0-rc.2"
          },
          {
            "tagName": "v2.13.0-rc.1"
          },
          {
            "tagName": "v2.12.3"
          },
          {
            "tagName": "v2.12.2"
          },
          {
            "tagName": "v2.12.1"
          },
          {
            "tagName": "v2.12.0"
          },
          {
            "tagName": "v2.12.0-rc.2"
          },
          {
            "tagName": "v2.12.0-rc.1"
          },
          {
            "tagName": "v2.11.0"
          },
          {
            "tagName": "v2.11.0-rc.4"
          },
          {
            "tagName": "v2.11.0-rc.3"
          },
          {
            "tagName": "v2.11.0-rc.2"
          },
          {
            "tagName": "v2.11.0-rc.1"
          },
          {
            "tagName": "v2.10.0"
          },
          {
            "tagName": "v2.10.0-rc.3"
          },
          {
            "tagName": "v2.10.0-rc.2"
          },
          {
            "tagName": "v2.10.0-rc.1"
          },
          {
            "tagName": "v2.9.1"
          },
          {
            "tagName": "v2.9.0"
          },
          {
            "tagName": "v2.9.0-rc5"
          },
          {
            "tagName": "v2.9.0-rc4"
          },
          {
            "tagName": "v2.9.0-rc3"
          },
          {
            "tagName": "v2.9.0-rc2"
          },
          {
            "tagName": "v2.9.0-rc1"
          },
          {
            "tagName": "v2.8.2"
          },
          {
            "tagName": "v2.8.1"
          },
          {
            "tagName": "v2.8.0"
          },
          {
            "tagName": "v2.8.0-rc.1"
          },
          {
            "tagName": "v2.7.2"
          },
          {
            "tagName": "v2.7.1"
          },
          {
            "tagName": "v2.7.0"
          },
          {
            "tagName": "v2.7.0-rc1"
          },
          {
            "tagName": "v2.6.2"
          },
          {
            "tagName": "v2.6.1"
          },
          {
            "tagName": "v2.6.0"
          },
          {
            "tagName": "v2.5.1"
          },
          {
            "tagName": "v2.5.0"
          },
          {
            "tagName": "v2.4.2"
          },
          {
            "tagName": "v2.4.1"
          },
          {
            "tagName": "v2.4.0"
          },
          {
            "tagName": "v2.3.1"
          },
          {
            "tagName": "v2.3.0"
          },
          {
            "tagName": "v2.2.3"
          },
          {
            "tagName": "v2.2.2"
          },
          {
            "tagName": "v2.2.1"
          },
          {
            "tagName": "v2.2.0"
          },
          {
            "tagName": "v2.1.3"
          },
          {
            "tagName": "v2.1.2"
          },
          {
            "tagName": "v2.1.1"
          },
          {
            "tagName": "v2.1.0"
          },
          {
            "tagName": "v2.0.2"
          },
          {
            "tagName": "v2.0.1"
          },
          {
            "tagName": "v2.0.0"
          },
          {
            "tagName": "v2.0.0-rc.2"
          },
          {
            "tagName": "v2.0.0-rc.1"
          },
          {
            "tagName": "v2.0.0-beta.2"
          },
          {
            "tagName": "v2.0.0-beta.1"
          },
          {
            "tagName": "v2.0.0-alpha.5"
          },
          {
            "tagName": "v2.0.0-alpha.4"
          },
          {
            "tagName": "v2.0.0-alpha.3"
          },
          {
            "tagName": "v2.0.0-alpha.2"
          },
          {
            "tagName": "v2.0.0-alpha.1"
          },
          {
            "tagName": "v1.2.1"
          }
        ]
      }
    }
  }
}
OliverMKing commented 2 years ago

This issue was created first but it is a duplicate of #99. There's more discussion on #99 so I'm going to close this for now.

it should install the latest version using the script provided by the helm team listed in the docs here: https://helm.sh/docs/intro/install/

We've looked into this install script before and opted not to use it because it doesn't work on Windows runners. Also this action needs to be able to support installing specific helm versions so we need some install functionality built into this action either way. If we could get it working for windows it does seem like a better solution.

Thank you for the issue!