GitLab runner 只执行一个命令
GitLab runner only executing one command
我在.gitlab-ci.yml
中有如下配置:
stages:
- build
build:
stage: build
script:
- npm install -g gulp
- npm install
- gulp
但是运行器只执行了第一个命令 (npm install -g gulp
)。它运行第一个命令并报告成功,但不执行其他命令。
构建日志:
Running with gitlab-ci-multi-runner 1.6.1 (c52ad4f)
Using Shell executor...
Running on WINBUILDER...
Fetching changes...
HEAD is now at 2df18c5 Update .gitlab-ci.yml
From https://.../client
2df18c5..b4efae8 master -> origin/master
Checking out b4efae85 as master...
$ npm install -g gulp
C:\Users\Administrator\AppData\Roaming\npm\gulp -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
C:\Users\Administrator\AppData\Roaming\npm
`-- gulp@3.9.1
Build succeeded
我见过几个在一个阶段使用多个命令的配置示例。我不明白为什么其他命令不是 运行.
这实际上是一个 NPM 错误,如下所述:
https://github.com/npm/npm/issues/2938
NPM 在退出时关闭 shell 并且不会调用后续命令。
上述问题中描述了解决方法。只需在调用 NPM 之前添加一条 call
命令:
stages:
- build
build:
stage: build
script:
- call npm install -g gulp
- call npm install
- gulp
我在.gitlab-ci.yml
中有如下配置:
stages:
- build
build:
stage: build
script:
- npm install -g gulp
- npm install
- gulp
但是运行器只执行了第一个命令 (npm install -g gulp
)。它运行第一个命令并报告成功,但不执行其他命令。
构建日志:
Running with gitlab-ci-multi-runner 1.6.1 (c52ad4f)
Using Shell executor...
Running on WINBUILDER...
Fetching changes...
HEAD is now at 2df18c5 Update .gitlab-ci.yml
From https://.../client
2df18c5..b4efae8 master -> origin/master
Checking out b4efae85 as master...
$ npm install -g gulp
C:\Users\Administrator\AppData\Roaming\npm\gulp -> C:\Users\Administrator\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
C:\Users\Administrator\AppData\Roaming\npm
`-- gulp@3.9.1
Build succeeded
我见过几个在一个阶段使用多个命令的配置示例。我不明白为什么其他命令不是 运行.
这实际上是一个 NPM 错误,如下所述:
https://github.com/npm/npm/issues/2938
NPM 在退出时关闭 shell 并且不会调用后续命令。
上述问题中描述了解决方法。只需在调用 NPM 之前添加一条 call
命令:
stages:
- build
build:
stage: build
script:
- call npm install -g gulp
- call npm install
- gulp