added remark for notify
parent
ac2f01f144
commit
c59f8b730a
1
go.mod
1
go.mod
|
@ -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
|
||||
|
|
|
@ -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}}"
|
||||
}
|
||||
`
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue