From 3cd1d237d43f5b588ebeff10c16bf2a419caedfc Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Sun, 11 Oct 2020 05:56:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=B4=E6=8A=A4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/index.js | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/routes/index.js b/routes/index.js index 1fa8c5a..6fa6625 100644 --- a/routes/index.js +++ b/routes/index.js @@ -58,10 +58,7 @@ router.post('/deploy', function(req, res, next) { info(updated_at) try { - startDeploy[name] = { - startTime: moment(), - description: description - } + const startTime=moment() dingding(`开始自动部署${name}|${description},更新日志:${commitsMsg}`) @@ -75,6 +72,9 @@ router.post('/deploy', function(req, res, next) { }); spawnObj.on('close', function (code) { info('close code : ' + code); + + dingding(`${name}|${description}自动部署成功,花费时间:${moment().diff(startTime, 'seconds', true)}秒`) + res.json({message:`仓库代码${name}部署成功`}) }) spawnObj.on('exit', (code) => { info('exit code : ' + code); @@ -91,19 +91,6 @@ router.post('/deploy', function(req, res, next) { }); -//部署完毕事件 -router.post('/finsh', function(req, res, next) { - if(req.body.name in startDeploy) { - let deployInfo=startDeploy[req.body.name] - dingding(`${req.body.name}|${deployInfo.description}自动部署成功,花费时间:${moment().diff(deployInfo.startTime, 'seconds', true)}秒`) - res.json({message:`仓库代码${req.body.name}部署成功`}) - }else { - let msg='参数异常,无法试别部署完毕事件' - error(msg) - res.json({msg}) - } - -}); //部署期间显示部署页面 router.get('/', function(req, res, next) {