二进制包上传到七牛后,刷新CDN

pull/21/merge
ouqiang 2017-05-09 14:37:40 +08:00
parent 95ea60f23c
commit 98bf5ee058
2 changed files with 22 additions and 5 deletions

View File

@ -148,11 +148,18 @@ func Store(ctx *macaron.Context, form TaskForm) string {
taskModel.NotifyReceiverId = form.NotifyReceiverId
taskModel.Spec = form.Spec
if taskModel.NotifyStatus > 0 && taskModel.NotifyReceiverId == "" {
return json.CommonFailure("请至少选择一个接收者", err)
return json.CommonFailure("请至少选择一个接收者")
}
if taskModel.Protocol == models.TaskHTTP && taskModel.Timeout == -1 {
return json.CommonFailure("HTTP任务不支持后台运行", err)
if taskModel.Protocol == models.TaskHTTP {
if taskModel.Timeout == -1 {
return json.CommonFailure("HTTP任务不支持后台运行")
}
if taskModel.Timeout > 300 {
return json.CommonFailure("HTTP任务超时时间不能超过300秒")
}
}
if taskModel.RetryTimes > 10 || taskModel.RetryTimes < 0 {
return json.CommonFailure("任务重试次数取值0-10")
}

View File

@ -2,6 +2,11 @@
# set -x -u
# 上传二进制包到七牛
if [[ -z $QINIU_ACCESS_KEY || -z $QINIU_SECRET_KEY || -z $QINIU_URL ]];then
echo 'QINIU_ACCESS_KEY | QINIU_SECRET_KEY | QINIU_URL is need'
exit 1
fi
# 打包
for i in linux darwin windows
do
@ -11,15 +16,20 @@ do
fi
done
# 身份认证
qrsctl login $QINIU_ACCESS_KEY $QINIU_SECRET_KEY
# 上传
for i in `ls gocron*.gz gocron*.zip`
do
# 身份认证 qrsctl login <AccessKey> <SecretKey>
# 上传文件 qrsctl put bucket key srcFile
qrsctl put github "gocron/${i}" $i
KEY=gocron/$i
qrsctl put github $KEY $i
if [[ ! $? ]];then
break
fi
echo "刷新七牛CDN-" $QINIU_URL/$KEY
qrsctl cdn/refresh $QINIU_URL/$KEY
rm $i
done