Skip to content

WATCHTOWER_NOTIFICATION_TEMPLATE wierd behavior #1478

@leruaa

Description

@leruaa

Describe the bug

When I use {{- toJson .Entries -}} in WATCHTOWER_NOTIFICATION_TEMPLATE, the output doesn't actually look like json.

the first output I get is:

Watchtower 1.5.1
Using notifications: generic+https
Checking all containers (except explicitly disabled with label)
Scheduling first run: 2022-11-16 19:20:00 +0100 CET
Note that the first check will be performed in 3 minutes, 11 seconds

Wich is not a json object.

Steps to reproduce

My conf is:

 environment:
      TZ: Europe/Paris
      WATCHTOWER_CLEANUP: true
      WATCHTOWER_NOTIFICATIONS_HOSTNAME: watchtower
      WATCHTOWER_NO_STARTUP_MESSAGE: false
      WATCHTOWER_SCHEDULE: "* */5 * * * *"
      WATCHTOWER_NOTIFICATION_URL: generic+https://XXXXXXXX.x.pipedream.net
      WATCHTOWER_NOTIFICATION_REPORT: true
      WATCHTOWER_NOTIFICATION_TEMPLATE: >
        {{- if .Report -}}
          {{- toJson .Report -}}
         {{- else -}}
          {{- toJson .Entries -}}
        {{- end -}}

Expected behavior

I should get a valid json object I guess

Screenshots

No response

Environment

Watchtower 1.5.1 on Linux Docker

Your logs

N/A

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions