added remark for notify

This commit is contained in:
solar
2020-12-03 21:02:49 +08:00
committed by qiang.ou
parent ac2f01f144
commit c59f8b730a
4 changed files with 7 additions and 1 deletions
+1
View File
@@ -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
+4 -1
View File
@@ -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}}"
}
`
+1
View File
@@ -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()
+1
View File
@@ -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)
}