我已经编写了.gitlab-ci.yml文件:
image: docker:latest
services:
- docker:dind
stages:
- deploy_front_end
deploy_front_end:
image: <<Some Curl Image >>
stage: deploy_front_end
only:
- master
tags:
- docker
- linux
script:
- echo "deploy_front_end Test"
- curl -o /dev/null -s -w %{time_total}\\n http://MachineName:6543/frontEndDeploy
我希望这能在运行expressJS代码的给定端口上击中计算机:
const express = require('express')
const child_process = require('child_process');
const app = express()
const port = 6543
app.route('/frontEndDeploy').get( (req, res) => {
child_process.exec('frontend.bat', function(error, stdout, stderr) {
console.log(stderr);
console.log(stdout);
if(stderr || error) res.status(500).send(stderr || error);
else res.send('frontend deployed successfully !!! '+ stdout);
});
})
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
frontend.bat在这里:
cd C:\Users\yytcadm\Downloads\Front_End
for /f "tokens=5" %%a in ('netstat -aon ^| find ":3000" ^| find "LISTENING"') do taskkill /f /pid %%a
npm install && npm start
代码在计算机中成功运行,但是管道作业失败,并且出现此错误,我该怎么办?请帮帮我! 谢谢!!!