crazy-max/diun

custom metadata with docker labels?

nopoz opened this issue · 0 comments

Support guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Reading https://github.com/crazy-max/diun/blob/master/docs/providers/docker.md it would seem to indicate that customizing the predefined metadata fields or custom meta data fields are possible with docker labels. However, testing this myself I can't seem to get it to work which makes me think this isn't currently possible and/or I'm reading the doc wrong.

The context is that I would like to make my notification titles read "<app name>:<version> is available" to make them as easy to read with as little extra text as possible. The closest I can get is templateTitle: "{{ .Entry.Image.Path }}:{{ .Entry.Image.Tag }} is available which also includes the repo name like linuxserver/plex:version-1.32.5.7349-8f4248874 is available. I don't need the ""linuxserver" portion from the example and can get it from the notification body if I really need it.

Thanks!

Expected behaviour

customize metadata with docker labels as per the docker.md file

Actual behaviour

can't customize metadata with docker labels

Steps to reproduce

Steps I tried:

  1. modify the container diun.metadata.ctn_id with a label and reference it in a notification template with {{ .Meta.ID }} - no effect, it remains "diun".
  2. create a custom label with diun.metadata.foo and reference it in a notification template with {{ .Meta.foo }} which throws an error in the diun logs: Pushover notification failed error="cannot render notif title: template: title:1:8: executing \"title\" at <.Meta.foo>: can't evaluate field foo in type model.Meta"

Diun version

4.26

Docker info

Server Version: 24.0.6

Docker Compose config

No response

Logs

Pushover notification failed error="cannot render notif title: template: title:1:8: executing \"title\" at <.Meta.foo>: can't evaluate field foo in type model.Meta

Additional info

No response