diun icon indicating copy to clipboard operation
diun copied to clipboard

Can't get sort_tags working

Open GeoCookie opened this issue 3 years ago • 1 comments

Hi there,

Behaviour

Steps to reproduce this issue

Use a file as provider with this inside (double dashes are to prevent Github to use bulleted list)

  -- name: ghcr.io/crazy-max/diun
    watch_repo: true
    max_tags: 10
    sort_tags: semver
    
  -- name: crazymax/diun
    watch_repo: true
    max_tags: 10
    sort_tags: semver

Expected behaviour

I expected Diun to get image tags sorted by version, thanks to sort_tags:semver Related to https://github.com/crazy-max/diun/pull/645

Actual behaviour

Diun receives the image tags in a random order image

Configuration

  • Diun version : 4.22
  • Platform : linux
  • System info (type uname -a) : Linux rikku.geocookie.lan 4.19.0-21-amd64 (#)1 SMP Debian 4.19.249-2 (2022-06-30) x86_64 GNU/Linux

I use a Docker run command for my test docker run --name diun-test
-e TZ=Europe/Paris
-e LOG_LEVEL=debug
-e LOG_JSON=false
-e DIUN_PROVIDERS_FILE_FILENAME=/data/service.yml
-v diun-test_diun-test_data:/data
ghcr.io/crazy-max/diun:4.22

Logs

The logs are quite long. Tell me if you need them (I searched in them and I can't find the word "semver" or "sort_tags"

GeoCookie avatar Jul 30 '22 10:07 GeoCookie

Edit: Sorry my bad, it seems it was fixed in 4.22.0, as now it works properly.

Hey, I also noticed odd behavior with semver, but using kubernetes, maybe this helps (formatted the log slightly, for easier reading):

Thu, 01 Sep 2022 21:36:51 CEST DBG Validate image ctn_image=crazymax/diun:4.21.0
                                                  ctn_name=diun
                                                  pod_annot={
                                                    "diun.enable":"true",
                                                    "diun.include_tags":"^\\d+\\.\\d+\\.\\d+$",
                                                    "diun.max_tags":"5",
                                                    "diun.sort_tags":"semver",
                                                    "diun.watch_repo":"true"
                                                  }
                                                  pod_name=diun-6d64f6d747-79jkg
                                                  provider=kubernetes
Thu, 01 Sep 2022 21:36:56 CEST INF New image found image=docker.io/crazymax/diun:4.21.0 provider=kubernetes
Thu, 01 Sep 2022 21:36:57 CEST INF New image found image=docker.io/crazymax/diun:4.6.1 provider=kubernetes
Thu, 01 Sep 2022 21:36:57 CEST INF New image found image=docker.io/crazymax/diun:4.8.1 provider=kubernetes
Thu, 01 Sep 2022 21:36:57 CEST INF New image found image=docker.io/crazymax/diun:4.8.0 provider=kubernetes
Thu, 01 Sep 2022 21:36:57 CEST INF New image found image=docker.io/crazymax/diun:4.7.0 provider=kubernetes
Thu, 01 Sep 2022 21:36:57 CEST INF New image found image=docker.io/crazymax/diun:4.9.0 provider=kubernetes

4.21.0 is my current diun tag, to test if it detects 4.22 properly, so it doesn't count here. It looks like, it either uses reverse anyway or there is an other issue....

ajgon avatar Sep 01 '22 19:09 ajgon

It's sorted. Logs output doesn't show it because the analysis is based on the number of workers that will execute the tasks concurrently through go routines (workers config) so some might be analyzed faster than others.

Maybe I could add some debug log to show the actual order.

crazy-max avatar Oct 09 '22 00:10 crazy-max

I tried with DIUN_WATCH_WORKERS=1 and indeed, the images are pulled in the correct order.

Thank you !

GeoCookie avatar Oct 15 '22 07:10 GeoCookie