Add semver sort option for tags listing and delete with -keep#29
Open
KarolBuchta wants to merge 2 commits intomlabouardy:masterfrom
Open
Add semver sort option for tags listing and delete with -keep#29KarolBuchta wants to merge 2 commits intomlabouardy:masterfrom
KarolBuchta wants to merge 2 commits intomlabouardy:masterfrom
Conversation
added 2 commits
July 31, 2018 11:08
…ep flag when deleting. This ways it is possible to retain the last X versions. Used an exception for 'latest' tag.
|
Is there any chance getting this merged and released? Thank you very much! |
|
Hi @KarolBuchta I see if we have tags with build number and git hash in them then sorting doesn't work as expected. 0.0.2-11 > 0.0.2-2 while it shows different. ./new-nexus-cli image tags -name pi-service --sort semver sort -V return the correct output. is there a way to have same in golang. |
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.
Description
Add semver sort option when listing tags as well as when using the keep flag when deleting. This ways it is possible to retain the last X versions. Used an exception for 'latest' tag.
The existing numeric sort breaks when you say you want to keep the last 5 versions:
`
1.0.1
1.0.11
1.1.0
2.0.0-alpha
2.0.0-beta
2.0.0
latest
`
As one can see, with the current numeric sort the order of 1.0.11 - 1.1.0 would be wrong wit numeric sort. In Semver it's 1.0.11 < 1.1.0. When using numeric sort it's 1.0.11 > 1.1.0 (wrong).
Hence I added an option for sorting -sort (default | semver)
Related Issue
#5
Changes proposed
Simply adding a good semver lib and an additional command line flag for tags listing and delete when using the keep option. Also updated the README.md.
Screenshots
No screenshots, the description and the listing of the versions should be sufficient to explain the problem and its solution.