lodthe / clickhouse-playground

On-demand ClickHouse playground
https://fiddle.clickhouse.com
Apache License 2.0
56 stars 4 forks source link

Sort images by tags #19

Closed evillique closed 1 year ago

evillique commented 2 years ago

The sorting of the versions on the website is a bit random, this is an attempt to fix it

image
lodthe commented 2 years 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.

evillique commented 2 years ago

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

lodthe commented 1 year ago

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",
image