|
|
|
@ -41,6 +41,7 @@ function dingding(message){ |
|
|
|
|
//记录开始部署的时间
|
|
|
|
|
const startDeploy={} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//web钩子事件
|
|
|
|
|
//git@gogs.kirito.cool:panqihua/RiskCloudMock.git push事件
|
|
|
|
|
router.post('/deploy', function(req, res, next) { |
|
|
|
@ -48,13 +49,14 @@ router.post('/deploy', function(req, res, next) { |
|
|
|
|
//提交日志,多次提交只取第一个
|
|
|
|
|
const commitsMsg=req.body.commits[0].message |
|
|
|
|
//更新时间
|
|
|
|
|
const updated_at=req.body.repository.updated_at |
|
|
|
|
const updated_at= moment(req.body.repository.updated_at).utcOffset(480).format('yyyy-MM-DD HH:mm:ss') |
|
|
|
|
//仓库名字
|
|
|
|
|
const name=req.body.repository.name |
|
|
|
|
//仓库描述信息
|
|
|
|
|
const description=req.body.repository.description |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
startDeploy[name] = { |
|
|
|
|
startTime: moment(), |
|
|
|
@ -96,8 +98,9 @@ router.post('/finsh', function(req, res, next) { |
|
|
|
|
dingding(`${req.body.name}|${deployInfo.description}自动部署成功,花费时间:${moment().diff(deployInfo.startTime, 'seconds', true)}秒`) |
|
|
|
|
res.json({message:`仓库代码${req.body.name}部署成功`}) |
|
|
|
|
}else { |
|
|
|
|
error('参数异常,无法试别部署完毕事件') |
|
|
|
|
res.error() |
|
|
|
|
let msg='参数异常,无法试别部署完毕事件' |
|
|
|
|
error(msg) |
|
|
|
|
res.json({msg}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|