Skip to content

Commit

Permalink
added remark for notify
Browse files Browse the repository at this point in the history
  • Loading branch information
feiin authored and ouqiang committed Dec 3, 2020
1 parent ac2f01f commit c59f8b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -27,6 +27,7 @@ require (
github.com/urfave/cli v1.20.0
golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5 // indirect
golang.org/x/net v0.0.0-20190522155817-f3200d17e092
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
golang.org/x/text v0.3.2 // indirect
google.golang.org/genproto v0.0.0-20190530194941-fb225487d101 // indirect
google.golang.org/grpc v1.21.0
Expand Down
5 changes: 4 additions & 1 deletion internal/models/setting.go
Expand Up @@ -16,19 +16,22 @@ const slackTemplate = `
任务名称: {{.TaskName}}
状态: {{.Status}}
执行结果: {{.Result}}
备注: {{.Remark}}
`
const emailTemplate = `
任务ID: {{.TaskId}}
任务名称: {{.TaskName}}
状态: {{.Status}}
执行结果: {{.Result}}
备注: {{.Remark}}
`
const webhookTemplate = `
{
"task_id": "{{.TaskId}}",
"task_name": "{{.TaskName}}",
"status": "{{.Status}}",
"result": "{{.Result}}"
"result": "{{.Result}}",
"remark": "{{.Remark}}"
}
`

Expand Down
1 change: 1 addition & 0 deletions internal/modules/notify/notify.go
Expand Up @@ -69,6 +69,7 @@ func parseNotifyTemplate(notifyTemplate string, msg Message) string {
"TaskName": msg["name"],
"Status": msg["status"],
"Result": msg["output"],
"Remark": msg["remark"],
})

return buf.String()
Expand Down
1 change: 1 addition & 0 deletions internal/service/task.go
Expand Up @@ -456,6 +456,7 @@ func SendNotification(taskModel models.Task, taskResult TaskResult) {
"output": taskResult.Result,
"status": statusName,
"task_id": taskModel.Id,
"remark": taskModel.Remark,
}
notify.Push(msg)
}
Expand Down

0 comments on commit c59f8b7

Please sign in to comment.