Commit 8ad6bfef authored by 智勇's avatar 智勇

项目管理校验

parent 7287b8f7
...@@ -42,7 +42,7 @@ const jenkinsBuild = async function (gitObject, gitUser, commitMes, timestamp) { ...@@ -42,7 +42,7 @@ const jenkinsBuild = async function (gitObject, gitUser, commitMes, timestamp) {
commitMes, commitMes,
projectName: gitObject.repository, projectName: gitObject.repository,
gitUser, gitUser,
gitEventTime: timestamp, gitEventTime: timestamp || moment().format('YYYY-MM-DD HH:mm:ss'),
} }
await PipeLinePush.savePipesPush(store) await PipeLinePush.savePipesPush(store)
} }
...@@ -128,9 +128,10 @@ const findPipes = async function (ctx) { ...@@ -128,9 +128,10 @@ const findPipes = async function (ctx) {
const save = async function (ctx) { const save = async function (ctx) {
const data = ctx.request.body const data = ctx.request.body
await PipeLine.savePipes(data) await PipeLine.savePipes(data)
logger.info('save pipeline application', data)
for (const item of data.repos) { for (const item of data.repos) {
logger.info('save pipeline application', item) logger.info('jenkinsBuild on save pipeline application', data.application_name, item)
jenkinsBuild(item, 'qahome', 'save pipeline application', moment().format('YYYY-MM-DD HH:mm:ss')) jenkinsBuild(item, data.update_user || data.new_user, 'save pipeline application')
} }
ctx.body = ctx.ok('ok') ctx.body = ctx.ok('ok')
} }
...@@ -150,7 +151,7 @@ const sendData = async (namespace, projectName, branchName, gitUser, flag, messa ...@@ -150,7 +151,7 @@ const sendData = async (namespace, projectName, branchName, gitUser, flag, messa
+ `> 部署空间 : ${namespace}\n\n` + `> 部署空间 : ${namespace}\n\n`
+ `> 触发同学 : ${gitUser}\n\n` + `> 触发同学 : ${gitUser}\n\n`
+ `> 触发时间 : ${moment().format('YYYY-MM-DD HH:mm:ss')}\n\n` + `> 触发时间 : ${moment().format('YYYY-MM-DD HH:mm:ss')}\n\n`
+ `> 提交信息 : ${message}\n\n` + `> 触发信息 : ${message}\n\n`
+ `#### 结果 : ${flag === 'success' ? '成功' : '失败'} [查看详情](${url}${type}/${buildNumber}/)`, + `#### 结果 : ${flag === 'success' ? '成功' : '失败'} [查看详情](${url}${type}/${buildNumber}/)`,
}, },
} }
......
...@@ -46,6 +46,12 @@ const save = async function (ctx) { ...@@ -46,6 +46,12 @@ const save = async function (ctx) {
ctx.body = ctx.fail(ctx.Code.ERROR_GITPATH) ctx.body = ctx.fail(ctx.Code.ERROR_GITPATH)
return return
} }
if (~data.host_name.indexOf('://')) {
ctx.body = ctx.fail('线上域名不要有 http://')
return
}
data.git_lab = match[1] data.git_lab = match[1]
data.git_path_group = match[2] data.git_path_group = match[2]
data.project_name = match[3] data.project_name = match[3]
......
...@@ -12,7 +12,7 @@ const authenticate = require('../service/authenticate') ...@@ -12,7 +12,7 @@ const authenticate = require('../service/authenticate')
const router = new Router() const router = new Router()
const admin = ['zhijie.xue', 'luoyong.meng', 'kewei.jia', 'hui.hu', 'yong.zhi'] const admin = ['zhijie.xue', 'luoyong.meng', 'kewei.jia', 'hui.hu', 'yong.zhi', 'haiyuan.wen']
const login = async function (ctx) { const login = async function (ctx) {
const { body } = ctx.request const { body } = ctx.request
......
...@@ -21,8 +21,7 @@ const logger = log4js.getLogger() ...@@ -21,8 +21,7 @@ const logger = log4js.getLogger()
require('../app/service/mongoService') require('../app/service/mongoService')
require('../app/service/redisService') require('../app/service/redisService')
require('../app/jobs') // require('../app/jobs')
const logFormat = ':req[x-real-ip] :req[x-forwarded-for] - -' const logFormat = ':req[x-real-ip] :req[x-forwarded-for] - -'
+ ' ":method :url HTTP/:http-version"' + ' ":method :url HTTP/:http-version"'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment