Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add notification (resp. notification filter) for monitored-only containers #1936

Open
passibe15 opened this issue Feb 26, 2024 · 1 comment

Comments

@passibe15
Copy link

Is your feature request related to a problem? Please describe.

I have some containers that are set to monitor only (via com.centurylinklabs.watchtower.monitor-only: "true" label).
I have configured the following notification template.

        {{- if .Report -}}
          {{- with .Report -}}
            {{- if ( or .Updated .Skipped .Failed ) -}}
        {{len .Updated}} Updated, {{len .Skipped}} Skipped, {{len .Failed}} Failed
              {{- range .Updated}}
        - {{.Name}} ({{.ImageName}}): {{.CurrentImageID.ShortID}} updated to {{.LatestImageID.ShortID}}
              {{- end -}}
              {{- range .Skipped}}
        - {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
              {{- end -}}
              {{- range .Failed}}
        - {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
              {{- end -}}
            {{- end -}}
          {{- end -}}
        {{- else -}}
          {{range .Entries -}}{{.Message}}{{"\n"}}{{- end -}}
        {{- end -}}

However, I do not get a notification for monitored-only containers.
Using {{- if ( or .Fresh .Updated .Skipped .Failed ) -}} in combination with {{- range .Fresh}} is not an option as this spits out all containers that were checked by watchtower regardless of whether there is a new version available or not.

Describe the solution you'd like

It would be nice if there was a .MonitoredOnly property (or something like that) for containers where {{- if ne .CurrentImageID.ShortID .LatestImageID.ShortID }} is true, but the container is not part of {{- range .Updated}}.

Describe alternatives you've considered

I tried using {{- if ne .CurrentImageID.ShortID .LatestImageID.ShortID }}, to print out notifications, and while that works in e.g. telling me which containers received a new version, it does not allow me to filter only the containers that are not part of {{- range .Updated}} and – more importantly – with this I cannot modify the {{- if ( or .Updated .Skipped .Failed ) -}} part of the template.
Thus I only get a notification either when watchtower also made updates or – if I add .Fresh as described above – every time watchtower runs.

Additional context

No response

Copy link

Hi there! 👋🏼 As you're new to this repo, we'd like to suggest that you read our code of conduct as well as our contribution guidelines. Thanks a bunch for opening your first issue! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant