Compare commits

...
5 Commits
Author SHA1 Message Date
chaiydandqiang.ou 960fc988b1 Update Dockerfile 2020-12-03 21:16:53 +08:00
chaiydandqiang.ou 7a949a22bf Update Dockerfile 2020-12-03 21:16:53 +08:00
solarandqiang.ou c59f8b730a added remark for notify 2020-12-03 21:02:49 +08:00
EamonZhangandqiang.ou ac2f01f144 修改 当后端使用postgres数据库时 修改任务或用户状态报错问题。postgres字段区分大小写。 2020-04-28 08:57:28 +08:00
Eamonandqiang.ou 09834ffaf6 修改后端使用postgres时,任务关闭/打开 错误
任务状态Status 改为 status
postgres 数据库 字段区分大小写
2020-04-28 08:57:28 +08:00
7 changed files with 22 additions and 12 deletions
+13 -9
View File
@@ -1,18 +1,22 @@
FROM golang:1.10-alpine as builder
WORKDIR /go/src/github.com/ouqiang/gocron
COPY . .
FROM golang:1.15-alpine as builder
RUN apk update \
&& apk add --no-cache git ca-certificates make bash nodejs yarn
&& apk add --no-cache git ca-certificates make bash yarn nodejs
RUN make install-vue \
RUN go env -w GO111MODULE=on && \
go env -w GOPROXY=https://goproxy.cn,direct
WORKDIR /app
RUN git clone https://github.com/ouqiang/gocron.git \
&& cd gocron \
&& yarn config set ignore-engines true \
&& make install-vue \
&& make build-vue \
&& make statik \
&& CGO_ENABLED=0 make gocron
FROM alpine:3.7
FROM alpine:3.12
RUN apk add --no-cache ca-certificates tzdata \
&& addgroup -S app \
@@ -22,7 +26,7 @@ RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
WORKDIR /app
COPY --from=builder /go/src/github.com/ouqiang/gocron/bin/gocron .
COPY --from=builder /app/gocron/bin/gocron .
RUN chown -R app:app ./
+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 -1
View File
@@ -251,7 +251,7 @@ func changeStatus(ctx *macaron.Context, status models.Status) string {
json := utils.JsonResponse{}
taskModel := new(models.Task)
_, err := taskModel.Update(id, models.CommonMap{
"Status": status,
"status": status,
})
if err != nil {
return json.CommonFailure(utils.FailureContent, err)
+1 -1
View File
@@ -163,7 +163,7 @@ func changeStatus(ctx *macaron.Context, status models.Status) string {
json := utils.JsonResponse{}
userModel := new(models.User)
_, err := userModel.Update(id, models.CommonMap{
"Status": status,
"status": status,
})
if err != nil {
return json.CommonFailure(utils.FailureContent, err)
+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)
}