I need to get the latest version of a specific NuGet package in Artifactory.
I use following JFrog CLI command to receive a list of all versions (later on with --limit=1
), including JSON parsing with jq:
jfrog rt s myRepo/Path/ --props "nuget.id=MyLib" --sort-by=name --sort-order=desc | jq -M -r ".[] | .props.\"nuget.version\" | .[]"
The above example results in raw string output like this:
1.2.3.101
1.2.3.103
1.2.3.95
1.2.3.99
1.2.3.99-beta10
1.2.3.99-beta9
My target is to get an output sorted by version:
1.2.3.95
1.2.3.99
1.2.3.99-beta9
1.2.3.99-beta10
1.2.3.101
1.2.3.103
Unfortunately I can not use --sort-by=created
as it can differ from version-sorting. Even if I do not use --sort-by
option it does not work. Also the version numbers can contain letters like "-beta".
In the Artifactory TreeView it is correct, but not in CLI.
How can I get a result sorted-by version number?
jq: error (at <stdin>:150): split input and separator must be strings
. – Harneen