-
Notifications
You must be signed in to change notification settings - Fork 908
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
Mute some types of notifications but always sending notifications when images update #1313
Comments
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! 🙏 |
This is possible to do with the new "report" notification templates. To enable them, add The default template look like this: watchtower/pkg/notifications/shoutrrr.go Lines 21 to 42 in 30f36b3
If you just put that template, but omitting the else clause
it will only notify with the results of a session, not the individual log records. You can also modify the condition for when to send it, from |
Something like this: version: "3"
services:
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
WATCHTOWER_NOTIFICATION_TEMPLATE: >
{{- if .Report -}}
{{- with .Report -}}
{{- if ( .Updated ) -}}
{{len .Scanned}} Scanned, {{len .Updated}} Updated, {{len .Failed}} Failed
{{- range .Updated}}
- {{.Name}} ({{.ImageName}}): {{.CurrentImageID.ShortID}} updated to {{.LatestImageID.ShortID}}
{{- end -}}
{{- range .Fresh}}
- {{.Name}} ({{.ImageName}}): {{.State}}
{{- end -}}
{{- range .Skipped}}
- {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
{{- end -}}
{{- range .Failed}}
- {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
WATCHTOWER_NOTIFICATION_REPORT: "true" |
Thanks @piksel! I was looking for this, Docker and other registries have multiple outages per day, so muting the errors is quite useful. Maybe it would be good to link to this issue in the documentation? |
I got this error when I tried to apply the custom template:
Edit: adding |
Is your feature request related to a problem? Please describe.
We have some servers behind the cooperate proxy and the connection to the internet is not stable. So we always got spammed by the
Could not do a head request...
notifications:This is ok we can bear this type of network issues but there's no way to disable this type of notifications while we can receive the real image update notifications.
When we set
WATCHTOWER_NOTIFICATIONS_LEVEL
towarn
or higher. The regular update notifications will also be muted.Describe the solution you'd like
Add an option to always send the real update notifications even when
WATCHTOWER_NOTIFICATIONS_LEVEL
is set towarn
or higher. ie.WATCHTOWER_NOTIFICATIONS_ALWAYS_SEND_UPDATES
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: