mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 13:23:09 +01:00
Option to render fields (#480)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
@@ -15,8 +15,8 @@ Allow to send notifications to your Discord channel.
|
||||
- "<@124>"
|
||||
- "<@125>"
|
||||
- "<@&200>"
|
||||
renderFields: true
|
||||
timeout: 10s
|
||||
templateTitle: "{{ .Entry.Image }} released"
|
||||
templateBody: |
|
||||
Docker tag {{ .Entry.Image }} which you subscribed to through {{ .Entry.Provider }} provider has been released.
|
||||
```
|
||||
@@ -25,23 +25,17 @@ Allow to send notifications to your Discord channel.
|
||||
|---------------------|---------------------------------------|---------------|
|
||||
| `webhookURL`[^1] | | Discord [incoming webhook URL](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) |
|
||||
| `mentions` | | List of users or roles to notify |
|
||||
| `renderFields` | `true` | Render [field objects](https://discordjs.guide/popular-topics/embeds.html) |
|
||||
| `timeout` | `10s` | Timeout specifies a time limit for the request to be made |
|
||||
| `templateTitle`[^1] | See [below](#default-templatetitle) | [Notification template](../faq.md#notification-template) for message title |
|
||||
| `templateBody`[^1] | See [below](#default-templatebody) | [Notification template](../faq.md#notification-template) for message body |
|
||||
|
||||
!!! abstract "Environment variables"
|
||||
* `DIUN_NOTIF_DISCORD_WEBHOOKURL`
|
||||
* `DIUN_NOTIF_DISCORD_MENTIONS` (comma separated)
|
||||
* `DIUN_NOTIF_DISCORD_RENDERFIELDS`
|
||||
* `DIUN_NOTIF_DISCORD_TIMEOUT`
|
||||
* `DIUN_NOTIF_DISCORD_TEMPLATETITLE`
|
||||
* `DIUN_NOTIF_DISCORD_TEMPLATEBODY`
|
||||
|
||||
### Default `templateTitle`
|
||||
|
||||
```
|
||||
[[ config.extra.template.defaultTitle ]]
|
||||
```
|
||||
|
||||
### Default `templateBody`
|
||||
|
||||
```
|
||||
|
||||
@@ -12,6 +12,7 @@ Allow to send notifications to your Rocket.Chat channel.
|
||||
channel: "#general"
|
||||
userID: abcdEFGH012345678
|
||||
token: Token123456
|
||||
renderAttachment: true
|
||||
timeout: 10s
|
||||
templateTitle: "{{ .Entry.Image }} released"
|
||||
templateBody: |
|
||||
@@ -25,6 +26,7 @@ Allow to send notifications to your Rocket.Chat channel.
|
||||
| `userID`[^1] | | User ID |
|
||||
| `token` | | Authentication token |
|
||||
| `tokenFile` | | Use content of secret file as authentication token if `token` not defined |
|
||||
| `renderAttachment` | `true` | Render [attachment object](https://docs.rocket.chat/guides/user-guides/messaging#send-attachments) |
|
||||
| `timeout` | `10s` | Timeout specifies a time limit for the request to be made |
|
||||
| `templateTitle`[^1] | See [below](#default-templatetitle) | [Notification template](../faq.md#notification-template) for message title |
|
||||
| `templateBody`[^1] | See [below](#default-templatebody) | [Notification template](../faq.md#notification-template) for message body |
|
||||
@@ -38,6 +40,7 @@ Allow to send notifications to your Rocket.Chat channel.
|
||||
* `DIUN_NOTIF_ROCKETCHAT_USERID`
|
||||
* `DIUN_NOTIF_ROCKETCHAT_TOKEN`
|
||||
* `DIUN_NOTIF_ROCKETCHAT_TOKENFILE`
|
||||
* `DIUN_NOTIF_ROCKETCHAT_RENDERATTACHMENT`
|
||||
* `DIUN_NOTIF_ROCKETCHAT_TIMEOUT`
|
||||
* `DIUN_NOTIF_ROCKETCHAT_TEMPLATETITLE`
|
||||
* `DIUN_NOTIF_ROCKETCHAT_TEMPLATEBODY`
|
||||
|
||||
@@ -12,6 +12,7 @@ You can send notifications to your Slack channel using an [incoming webhook URL]
|
||||
notif:
|
||||
slack:
|
||||
webhookURL: https://hooks.slack.com/services/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||
renderFields: true
|
||||
templateBody: |
|
||||
Docker tag {{ .Entry.Image }} which you subscribed to through {{ .Entry.Provider }} provider has been released.
|
||||
```
|
||||
@@ -19,16 +20,18 @@ You can send notifications to your Slack channel using an [incoming webhook URL]
|
||||
| Name | Default | Description |
|
||||
|--------------------|--------------------------------------------|---------------|
|
||||
| `webhookURL`[^1] | | Slack [incoming webhook URL](https://api.slack.com/messaging/webhooks) |
|
||||
| `renderFields` | `true` | Render [field objects](https://api.slack.com/messaging/composing/layouts#stack_of_blocks) |
|
||||
| `templateBody`[^1] | See [below](#default-templatebody) | [Notification template](../faq.md#notification-template) for message body |
|
||||
|
||||
!!! abstract "Environment variables"
|
||||
* `DIUN_NOTIF_SLACK_WEBHOOKURL`
|
||||
* `DIUN_NOTIF_SLACK_RENDERFIELDS`
|
||||
* `DIUN_NOTIF_SLACK_TEMPLATEBODY`
|
||||
|
||||
### Default `templateBody`
|
||||
|
||||
```
|
||||
<!channel> Docker tag `{{ .Entry.Image }}` {{ if (eq .Entry.Status "new") }}newly added{{ else }}updated{{ end }}.
|
||||
<!channel> Docker tag {{ if .Entry.Image.HubLink }}<{{ .Entry.Image.HubLink }}|`{{ .Entry.Image }}`>{{ else }}`{{ .Entry.Image }}`{{ end }} {{ if (eq .Entry.Status "new") }}available{{ else }}updated{{ end }}.
|
||||
```
|
||||
|
||||
## Sample
|
||||
|
||||
@@ -9,6 +9,7 @@ You can send notifications to your Teams team-channel using an [incoming webhook
|
||||
notif:
|
||||
teams:
|
||||
webhookURL: https://outlook.office.com/webhook/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||
renderFacts: true
|
||||
templateBody: |
|
||||
Docker tag {{ .Entry.Image }} which you subscribed to through {{ .Entry.Provider }} provider has been released.
|
||||
```
|
||||
@@ -16,10 +17,12 @@ You can send notifications to your Teams team-channel using an [incoming webhook
|
||||
| Name | Default | Description |
|
||||
|--------------------|--------------------------------------------|---------------|
|
||||
| `webhookURL`[^1] | | Teams [incoming webhook URL](https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/what-are-webhooks-and-connectors) |
|
||||
| `renderFacts` | `true` | Render fact objects |
|
||||
| `templateBody`[^1] | See [below](#default-templatebody) | [Notification template](../faq.md#notification-template) for message body |
|
||||
|
||||
!!! abstract "Environment variables"
|
||||
* `DIUN_NOTIF_TEAMS_WEBHOOKURL`
|
||||
* `DIUN_NOTIF_TEAMS_RENDERFACTS`
|
||||
* `DIUN_NOTIF_TEAMS_TEMPLATEBODY`
|
||||
|
||||
### Default `templateBody`
|
||||
|
||||
@@ -76,8 +76,8 @@ func TestLoadFile(t *testing.T) {
|
||||
"<@125>",
|
||||
"<@&200>",
|
||||
},
|
||||
RenderFields: utl.NewTrue(),
|
||||
Timeout: utl.NewDuration(10 * time.Second),
|
||||
TemplateTitle: model.NotifDefaultTemplateTitle,
|
||||
TemplateBody: model.NotifDefaultTemplateBody,
|
||||
},
|
||||
Gotify: &model.NotifGotify{
|
||||
@@ -137,6 +137,7 @@ for <code>{{ .Entry.Manifest.Platform }}</code> platform.
|
||||
Channel: "#general",
|
||||
UserID: "abcdEFGH012345678",
|
||||
Token: "Token123456",
|
||||
RenderAttachment: utl.NewTrue(),
|
||||
Timeout: utl.NewDuration(10 * time.Second),
|
||||
TemplateTitle: model.NotifDefaultTemplateTitle,
|
||||
TemplateBody: model.NotifRocketChatDefaultTemplateBody,
|
||||
@@ -149,10 +150,12 @@ for <code>{{ .Entry.Manifest.Platform }}</code> platform.
|
||||
},
|
||||
Slack: &model.NotifSlack{
|
||||
WebhookURL: "https://hooks.slack.com/services/ABCD12EFG/HIJK34LMN/01234567890abcdefghij",
|
||||
RenderFields: utl.NewFalse(),
|
||||
TemplateBody: model.NotifSlackDefaultTemplateBody,
|
||||
},
|
||||
Teams: &model.NotifTeams{
|
||||
WebhookURL: "https://outlook.office.com/webhook/ABCD12EFG/HIJK34LMN/01234567890abcdefghij",
|
||||
RenderFacts: utl.NewFalse(),
|
||||
TemplateBody: model.NotifTeamsDefaultTemplateBody,
|
||||
},
|
||||
Telegram: &model.NotifTelegram{
|
||||
|
||||
@@ -25,6 +25,7 @@ notif:
|
||||
- "<@124>"
|
||||
- "<@125>"
|
||||
- "<@&200>"
|
||||
renderFields: true
|
||||
timeout: 10s
|
||||
gotify:
|
||||
endpoint: http://gotify.foo.com
|
||||
@@ -69,6 +70,7 @@ notif:
|
||||
channel: "#general"
|
||||
userID: abcdEFGH012345678
|
||||
token: Token123456
|
||||
renderAttachment: true
|
||||
timeout: 10s
|
||||
script:
|
||||
cmd: "uname"
|
||||
@@ -76,8 +78,10 @@ notif:
|
||||
- "-a"
|
||||
slack:
|
||||
webhookURL: https://hooks.slack.com/services/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||
renderFields: false
|
||||
teams:
|
||||
webhookURL: https://outlook.office.com/webhook/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||
renderFacts: false
|
||||
telegram:
|
||||
token: abcdef123456
|
||||
chatIDs:
|
||||
|
||||
@@ -25,6 +25,7 @@ notif:
|
||||
- "<@124>"
|
||||
- "<@125>"
|
||||
- "<@&200>"
|
||||
renderFields: true
|
||||
timeout: 10s
|
||||
gotify:
|
||||
endpoint: http://gotify.foo.com
|
||||
@@ -67,6 +68,7 @@ notif:
|
||||
channel: "#general"
|
||||
userID: abcdEFGH012345678
|
||||
token: Token123456
|
||||
renderAttachment: false
|
||||
timeout: 10s
|
||||
script:
|
||||
cmd: "uname"
|
||||
@@ -74,8 +76,10 @@ notif:
|
||||
- "-a"
|
||||
slack:
|
||||
webhookURL: https://hooks.slack.com/services/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||
renderFields: false
|
||||
teams:
|
||||
webhookURL: https://outlook.office.com/webhook/ABCD12EFG/HIJK34LMN/01234567890abcdefghij
|
||||
renderFacts: true
|
||||
telegram:
|
||||
token: abcdef123456
|
||||
chatIDs:
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
type NotifDiscord struct {
|
||||
WebhookURL string `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
|
||||
Mentions []string `yaml:"mentions,omitempty" json:"mentions,omitempty"`
|
||||
RenderFields *bool `yaml:"renderFields,omitempty" json:"renderFields,omitempty" validate:"required"`
|
||||
Timeout *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
|
||||
TemplateTitle string `yaml:"templateTitle,omitempty" json:"templateTitle,omitempty" validate:"required"`
|
||||
TemplateBody string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func (s *NotifDiscord) GetDefaults() *NotifDiscord {
|
||||
|
||||
// SetDefaults sets the default values
|
||||
func (s *NotifDiscord) SetDefaults() {
|
||||
s.RenderFields = utl.NewTrue()
|
||||
s.Timeout = utl.NewDuration(10 * time.Second)
|
||||
s.TemplateTitle = NotifDefaultTemplateTitle
|
||||
s.TemplateBody = NotifDefaultTemplateBody
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ type NotifRocketChat struct {
|
||||
UserID string `yaml:"userID,omitempty" json:"userID,omitempty" validate:"required"`
|
||||
Token string `yaml:"token,omitempty" json:"token,omitempty" validate:"omitempty"`
|
||||
TokenFile string `yaml:"tokenFile,omitempty" json:"tokenFile,omitempty" validate:"omitempty,file"`
|
||||
RenderAttachment *bool `yaml:"renderAttachment,omitempty" json:"renderAttachment,omitempty" validate:"required"`
|
||||
Timeout *time.Duration `yaml:"timeout,omitempty" json:"timeout,omitempty" validate:"required"`
|
||||
TemplateTitle string `yaml:"templateTitle,omitempty" json:"templateTitle,omitempty" validate:"required"`
|
||||
TemplateBody string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
|
||||
@@ -30,6 +31,7 @@ func (s *NotifRocketChat) GetDefaults() *NotifRocketChat {
|
||||
|
||||
// SetDefaults sets the default values
|
||||
func (s *NotifRocketChat) SetDefaults() {
|
||||
s.RenderAttachment = utl.NewTrue()
|
||||
s.Timeout = utl.NewDuration(10 * time.Second)
|
||||
s.TemplateTitle = NotifDefaultTemplateTitle
|
||||
s.TemplateBody = NotifRocketChatDefaultTemplateBody
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package model
|
||||
|
||||
import "github.com/crazy-max/diun/v4/pkg/utl"
|
||||
|
||||
// NotifSlackDefaultTemplateBody ...
|
||||
const NotifSlackDefaultTemplateBody = "<!channel> Docker tag `{{ .Entry.Image }}` {{ if (eq .Entry.Status \"new\") }}available{{ else }}updated{{ end }}."
|
||||
const NotifSlackDefaultTemplateBody = "<!channel> Docker tag {{ if .Entry.Image.HubLink }}<{{ .Entry.Image.HubLink }}|`{{ .Entry.Image }}`>{{ else }}`{{ .Entry.Image }}`{{ end }} {{ if (eq .Entry.Status \"new\") }}available{{ else }}updated{{ end }}."
|
||||
|
||||
// NotifSlack holds slack notification configuration details
|
||||
type NotifSlack struct {
|
||||
WebhookURL string `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
|
||||
RenderFields *bool `yaml:"renderFields,omitempty" json:"renderFields,omitempty" validate:"required"`
|
||||
TemplateBody string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
@@ -18,5 +21,6 @@ func (s *NotifSlack) GetDefaults() *NotifSlack {
|
||||
|
||||
// SetDefaults sets the default values
|
||||
func (s *NotifSlack) SetDefaults() {
|
||||
s.RenderFields = utl.NewTrue()
|
||||
s.TemplateBody = NotifSlackDefaultTemplateBody
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package model
|
||||
|
||||
import "github.com/crazy-max/diun/v4/pkg/utl"
|
||||
|
||||
// NotifTeamsDefaultTemplateBody ...
|
||||
const NotifTeamsDefaultTemplateBody = "Docker tag {{ if .Entry.Image.HubLink }}[`{{ .Entry.Image }}`]({{ .Entry.Image.HubLink }}){{ else }}`{{ .Entry.Image }}`{{ end }} {{ if (eq .Entry.Status \"new\") }}available{{ else }}updated{{ end }}."
|
||||
|
||||
// NotifTeams holds Teams notification configuration details
|
||||
type NotifTeams struct {
|
||||
WebhookURL string `yaml:"webhookURL,omitempty" json:"webhookURL,omitempty" validate:"required"`
|
||||
RenderFacts *bool `yaml:"renderFacts,omitempty" json:"renderFacts,omitempty" validate:"required"`
|
||||
TemplateBody string `yaml:"templateBody,omitempty" json:"templateBody,omitempty" validate:"required"`
|
||||
}
|
||||
|
||||
@@ -18,5 +21,6 @@ func (s *NotifTeams) GetDefaults() *NotifTeams {
|
||||
|
||||
// SetDefaults sets the default values
|
||||
func (s *NotifTeams) SetDefaults() {
|
||||
s.RenderFacts = utl.NewTrue()
|
||||
s.TemplateBody = NotifTeamsDefaultTemplateBody
|
||||
}
|
||||
|
||||
@@ -47,14 +47,13 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
message, err := msg.New(msg.Options{
|
||||
Meta: c.meta,
|
||||
Entry: entry,
|
||||
TemplateTitle: c.cfg.TemplateTitle,
|
||||
TemplateBody: c.cfg.TemplateBody,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
title, body, err := message.RenderMarkdown()
|
||||
_, body, err := message.RenderMarkdown()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -64,9 +63,11 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
content.WriteString(fmt.Sprintf("%s ", mention))
|
||||
}
|
||||
}
|
||||
content.WriteString(string(title))
|
||||
content.WriteString(string(body))
|
||||
|
||||
fields := []EmbedField{
|
||||
var fields []EmbedField
|
||||
if *c.cfg.RenderFields {
|
||||
fields = []EmbedField{
|
||||
{
|
||||
Name: "Hostname",
|
||||
Value: c.meta.Hostname,
|
||||
@@ -94,6 +95,7 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
Value: entry.Image.HubLink,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
dataBuf := new(bytes.Buffer)
|
||||
if err := json.NewEncoder(dataBuf).Encode(Message{
|
||||
@@ -102,17 +104,15 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
AvatarURL: c.meta.Logo,
|
||||
Embeds: []Embed{
|
||||
{
|
||||
Description: string(body),
|
||||
Footer: EmbedFooter{
|
||||
Text: fmt.Sprintf("%s © %d %s %s", c.meta.Author, time.Now().Year(), c.meta.Name, c.meta.Version),
|
||||
IconURL: c.meta.Logo,
|
||||
},
|
||||
Author: EmbedAuthor{
|
||||
Name: c.meta.Name,
|
||||
URL: c.meta.URL,
|
||||
IconURL: c.meta.Logo,
|
||||
},
|
||||
Fields: fields,
|
||||
Footer: EmbedFooter{
|
||||
Text: fmt.Sprintf("%s © %d %s %s", c.meta.Author, time.Now().Year(), c.meta.Name, c.meta.Version),
|
||||
},
|
||||
},
|
||||
},
|
||||
}); err != nil {
|
||||
|
||||
@@ -66,6 +66,8 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
return err
|
||||
}
|
||||
|
||||
var attachments []Attachment
|
||||
if *c.cfg.RenderAttachment {
|
||||
fields := []AttachmentField{
|
||||
{
|
||||
Title: "Hostname",
|
||||
@@ -100,6 +102,12 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
Short: false,
|
||||
})
|
||||
}
|
||||
attachments = append(attachments, Attachment{
|
||||
Text: string(body),
|
||||
Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
|
||||
Fields: fields,
|
||||
})
|
||||
}
|
||||
|
||||
dataBuf := new(bytes.Buffer)
|
||||
if err := json.NewEncoder(dataBuf).Encode(Message{
|
||||
@@ -107,13 +115,7 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
Avatar: c.meta.Logo,
|
||||
Channel: c.cfg.Channel,
|
||||
Text: string(title),
|
||||
Attachments: []Attachment{
|
||||
{
|
||||
Text: string(body),
|
||||
Ts: json.Number(strconv.FormatInt(time.Now().Unix(), 10)),
|
||||
Fields: fields,
|
||||
},
|
||||
},
|
||||
Attachments: attachments,
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -50,12 +50,9 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
return err
|
||||
}
|
||||
|
||||
color := "#4caf50"
|
||||
if entry.Status == model.ImageStatusUpdate {
|
||||
color = "#0054ca"
|
||||
}
|
||||
|
||||
fields := []slack.AttachmentField{
|
||||
var fields []slack.AttachmentField
|
||||
if *c.cfg.RenderFields {
|
||||
fields = []slack.AttachmentField{
|
||||
{
|
||||
Title: "Hostname",
|
||||
Value: c.meta.Hostname,
|
||||
@@ -89,6 +86,12 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
Short: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
color := "#4caf50"
|
||||
if entry.Status == model.ImageStatusUpdate {
|
||||
color = "#0054ca"
|
||||
}
|
||||
|
||||
return slack.PostWebhook(c.cfg.WebhookURL, &slack.WebhookMessage{
|
||||
Attachments: []slack.Attachment{
|
||||
|
||||
@@ -3,6 +3,7 @@ package teams
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -71,6 +72,17 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
themeColor = "0076D7"
|
||||
}
|
||||
|
||||
var facts []Fact
|
||||
if *c.cfg.RenderFacts {
|
||||
facts = []Fact{
|
||||
{"Hostname", c.meta.Hostname},
|
||||
{"Provider", entry.Provider},
|
||||
{"Created", entry.Manifest.Created.Format("Jan 02, 2006 15:04:05 UTC")},
|
||||
{"Digest", entry.Manifest.Digest.String()},
|
||||
{"Platform", entry.Manifest.Platform},
|
||||
}
|
||||
}
|
||||
|
||||
jsonBody, err := json.Marshal(struct {
|
||||
Type string `json:"@type"`
|
||||
Context string `json:"@context"`
|
||||
@@ -82,16 +94,13 @@ func (c *Client) Send(entry model.NotifEntry) error {
|
||||
Context: "https://schema.org/extensions",
|
||||
ThemeColor: themeColor,
|
||||
Summary: string(body),
|
||||
Sections: []Sections{{
|
||||
Sections: []Sections{
|
||||
{
|
||||
ActivityTitle: string(body),
|
||||
ActivitySubtitle: "Provider: " + entry.Provider,
|
||||
Facts: []Fact{
|
||||
{"Hostname", c.meta.Hostname},
|
||||
{"Provider", entry.Provider},
|
||||
{"Created", entry.Manifest.Created.Format("Jan 02, 2006 15:04:05 UTC")},
|
||||
{"Digest", entry.Manifest.Digest.String()},
|
||||
{"Platform", entry.Manifest.Platform},
|
||||
}}},
|
||||
ActivitySubtitle: fmt.Sprintf("%s © %d %s %s", c.meta.Author, time.Now().Year(), c.meta.Name, c.meta.Version),
|
||||
Facts: facts,
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -24,11 +24,11 @@ extra:
|
||||
domain: crazymax.dev/diun
|
||||
template:
|
||||
defaultTitle: |
|
||||
{{ if (eq .Entry.Status "new") }}New image {{ .Entry.Image }} has been added{{ else }}Image update for {{ .Entry.Image }}{{ end }}
|
||||
{{ .Entry.Image }} {{ if (eq .Entry.Status "new") }}is available{{ else }}has been updated{{ .Entry.Image }}{{ end }}
|
||||
defaultBody: |
|
||||
Docker tag {{ if .Entry.Image.HubLink }}[**{{ .Entry.Image }}**]({{ .Entry.Image.HubLink }}){{ else }}**{{ .Entry.Image }}**{{ end }}
|
||||
which you subscribed to through {{ .Entry.Provider }} provider has been {{ if (eq .Entry.Status "new") }}newly added{{ else }}updated{{ end }}
|
||||
on {{ .Meta.Hostname }}.
|
||||
which you subscribed to through {{ .Entry.Provider }} provider {{ if (eq .Entry.Status "new") }}is available{{ else }}has been updated{{ end }}
|
||||
on {{ .Entry.Image.Domain }} registry (triggered by {{ .Meta.Hostname }} host).
|
||||
|
||||
theme:
|
||||
name: material
|
||||
|
||||
Reference in New Issue
Block a user