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

Clean formatting for email notifications #1907

Open
rwjack opened this issue Jan 20, 2024 · 1 comment
Open

Clean formatting for email notifications #1907

rwjack opened this issue Jan 20, 2024 · 1 comment

Comments

@rwjack
Copy link

rwjack commented Jan 20, 2024

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

Continuation of #815

I doubt people can see the value in a dump of text, such as this one:

Found new fireflyiii/core:latest image (d7123f673c25)
Found new mariadb:latest image (3e87f8bfed4e)
Could not do a head request for "cthulhoo/ttrss-web-nginx:latest", falling back to regular pull.
Reason: registry responded to head request with "404 Not Found", auth: "not present"
Found new cthulhoo/ttrss-web-nginx:latest image (ce5350fada33)
Found new cthulhoo/ttrss-fpm-pgsql-static:latest image (e1627c2a53c1)
Found new cthulhoo/ttrss-fpm-pgsql-static:latest image (e1627c2a53c1)
Found new cthulhoo/ttrss-fpm-pgsql-static:latest image (e1627c2a53c1)
Found new postgres:12-alpine image (07f0565a99b5)
Found new lscr.io/linuxserver/unifi-controller:latest image (24c56d51863e)
Stopping /unifi-controller (3b8ce540a354) with SIGTERM
Creating /unifi-controller
Stopping /ttrss_db (66a1a0e57333) with SIGTERM
Creating /ttrss_db
Stopping /ttrss (d0ca1a51e721) with SIGTERM
Creating /ttrss
Stopping /ttrss_backup (c4c23b1ee450) with SIGTERM
Creating /ttrss_backup
Stopping /ttrss_updater (dfa9509d4f15) with SIGTERM
Creating /ttrss_updater
Stopping /ttrss_nginx (510861d1292e) with SIGTERM
Creating /ttrss_nginx
Stopping /firefly-db-1 (846a9a03dc3a) with SIGTERM
Creating /firefly-db-1

Describe the solution you'd like

A clean default template.

Describe alternatives you've considered

Tried making my own, though since I'm not being familiar with go templating, I ended up with something like this.

Unfortunately, when the environment variable is set, I simply receive no notification email and no error message why the email didn't send. Meanwhile, using the default template works. I get the email, but it's the default unreadable template...

WATCHTOWER_NOTIFICATION_TEMPLATE='
{{- if .Report -}}
  {{- with .Report -}}
    {{- if ( or .Updated .Failed ) -}}
=======================
Watchtower Update Report
=======================
Scanned Containers: {{ len .Scanned }}
Updated Containers: {{ len .Updated }}
Failed Containers: {{ len .Failed }}

{{- if .Updated }}
Updated Containers:
{{- range .Updated}}
- {{.Name}} ({{.ImageName}}): {{.CurrentImageID.ShortID}} updated to {{.LatestImageID.ShortID}}
{{- end }}
{{- end }}

{{- if .Fresh }}
Fresh Containers:
{{- range .Fresh}}
- {{.Name}} ({{.ImageName}}): {{.State}}
{{- end }}
{{- end }}

{{- if .Skipped }}
Skipped Containers:
{{- range .Skipped}}
- {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
{{- end }}
{{- end }}

{{- if .Failed }}
Failed Containers:
{{- range .Failed}}
- {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}}
{{- end }}
{{- end }}

{{- end -}}
  {{- end -}}
{{- else -}}
=========================
Watchtower Log Entries
=========================
{{ range .Entries -}}{{.Message}}{{"\n"}}{{- end }}
{{- end -}}
'

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