Reputation: 835
My CI runner will only run a single line. I'm trying to run npm install
prior to eslint
. However, if I add npm install
to the before_script
section, then only npm install
runs and the build reports success without ever actually running eslint
. Are multiple commands not supported on a windows shell runner?
I also tried moving npm install
into the lint
job, with the same result.
I have installed the gitlab multi-runner on a windows host. Here is my .gitlab-ci.yml
before_script:
- npm install
stages:
- test
cache:
key: "$CI_BUILD_REF_NAME"
paths:
- node_modules/
lint:
stage: test
tags:
- javascript
script:
- eslint **/*.js
Upvotes: 4
Views: 1630
Reputation: 3187
Solution
You need to add "call" before any npm commands in your .gitlab-ci.yml file :
before_script:
- 'call npm install'
It is required for all npm commands when Windows shell runner is used.
Explanation
npm is a shell script. So you must add call to execute this script in a sub shell. Otherwise an "exit" command in the npm script closes the shell launched by gitlab.
See https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/issues/1025
Upvotes: 2
Reputation: 835
This is a problem with the default shell using cmd.exe on Windows. Changing it to Powershell seems to do the trick.
Upvotes: 0