fix(cli): ignore floating major tags when resolving latest version#714
Merged
Conversation
The new v0 floating Action tag sorted above exact versions in get_latest_tag, so 'bashunit upgrade' tried to download a v0 release asset that does not exist. Restrict candidates to exact-version tags.
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.
Summary
The 0.39.0 release published the floating
v0tag for the GitHub Action (#700).bashunit::helper::get_latest_tagsorts all remote tags withsort -Vr, andv0sorts above every exact version, sobashunit upgraderesolvedv0as the latest version and tried to download a release asset that does not exist.This broke two CI jobs on
main(Bash 3.0 Compatibility and Tests/Alpine) viatests/acceptance/bashunit_upgrade_test.sh, and breaksbashunit upgradeat runtime.Fix
Restrict latest-tag candidates to exact-version tags (
^[0-9]+\.[0-9]+(\.[0-9]+)?$) before sorting.Verification
test_get_latest_tag_ignores_floating_major_tags(RED: returnedv0; GREEN: returns0.39.0)tests/acceptance/bashunit_upgrade_test.shpasses against the real repo (downloads the 0.39.0 asset)--parallel)/bin/bash): helpers + upgrade tests greenmake sa,make lint,shfmtclean