在testing运行gitlab之后终止节点服务器

我想在我的gitlab服务器上启动一个节点服务器。 我已经build立了我的gitlab-ci.yml文件,这似乎工作。 但是,我想在testing完成后终止节点服务器。

我的gitlab-ci.yml文件的相关部分如下所示:

 unit_tests: stage: test variables: GIT_STRATEGY: clone script: - npm install - npm run websocket-server - npm test after_script: - //what should go here to kill the node server after the tests have run? 

你可以使用pkill

一个简单的使用方法可能是这样的:

 after_script: - pkill node 

阅读pkill(1)手册了解更多信息: https : //linux.die.net/man/1/pkill