Closed evillique closed 1 year ago
Hello! This invalid order of versions makes me unhappy too, but we cannot just sort tags in lexicographic order.
At least semver-friendly comparator should be used (splitting tags by '.' and comparing slices is enough), but I haven't yet come up with an idea of what to do with tags 'head', 'latest', and other non-semver tags.
It would be perfect if DockerHub provided us with the image tag creation date, but there is no such information (refer to the parsed dockerhub response).
I thought about hardcoding supported non-semver image tags (like 'latest', 'head', 'latest-alpine', 'head-alpine') and putting them at the beginning of the list of tags, but haven't yet decided if this is a good idea.
I made a new comparator, maybe it is a bit bulky, but overall it seems like it does the job: https://go.dev/play/p/Lm1PMLCsD3e
Implemented it in #21, thanks for the idea.
curl 'https://fiddle.clickhouse.com/api/tags' -s | jq . | head -n 20
{
"result": {
"tags": [
"head-alpine",
"head",
"latest-alpine",
"latest",
"22.11.2.30-alpine",
"22.11.2.30",
"22.11.2-alpine",
"22.11.2",
"22.11.1.1360-alpine",
"22.11.1.1360",
"22.11.1-alpine",
"22.11.1",
"22.11-alpine",
"22.11",
"22.10.4.23-alpine",
"22.10.4.23",
"22.10.4-alpine",
The sorting of the versions on the website is a bit random, this is an attempt to fix it