Repository navigation
fix(installer): read the latest tag off the web redirect, not the API - #5
Merged
Merged
Conversation
api.github.com/repos/<r>/releases/latest answers 200 with JSON and never redirects, so following it and looking for /tag/ in the effective URL always came up empty and every install died with 'could not work out the latest release tag'. The web URL does 302 to /releases/tag/<tag> and is not rate limited; the JSON tag_name is kept as a fallback for API-only mirrors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
curl .../install | shfailed for everyone withcould not work out the latest release tag.Cause: the script read the tag off
%{url_effective}forhttps://api.github.com/repos/dotmethodme/KubeTitan/releases/latest. That endpoint answers 200 with JSON and never redirects, so the effective URL is the API URL itself and thes|.*/tag/||match came up empty. The redirect only exists on the web URL,https://github.com/<repo>/releases/latest->/releases/tag/vX.Y.Z.Fix:
latestfrom the web redirect: no JSON parsing, no jq, and no API rate limit.tag_nameout of the API JSON as a fallback, for a mirror that only serves the API side.KT_VERSION=vX.Y.Zas the skip.Tested against the real v0.2.0 release:
KT_PREFIX=/tmp/kt sh install.sh->KubeTitan v0.2.0 for linux-x86_64,checksum ok, binary is a real ELF (177 E L F).KT_DL=http://127.0.0.1:9(web host dead) -> still resolves v0.2.0 through the JSON fallback.KT_REPO=dotmethodme/definitely-not-a-repo-> the new actionable error.Worth noting: this only goes live for the public command once it is on
main, since/installserves the raw script frommain. Until thenKT_VERSION=v0.2.0gets around it.