HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Gitlab Runner not running scripts with Windows shell configuration

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
scriptswithgitlabshellrunnerrunningwindowsconfigurationnot

Problem

I have a Gitlab Runner running locally on my windows box. It works fine for the before script section.

my .gitlab-ci.yml follows:

before_script:
  - pushd . && uru 233 && popd && set HOME=c:\ && ruby -v && bundle install

rspec:
  script:
    - bundle exec rspec

rubocop:
  script:
    - bundle exec rubocop

flay:
  script:
    - bundle exec flay *


It does not do anything after the before script, though. Does not run any of the jobs.

How can I find out what's going on?

I was able to fix it with a super-non-ideal/hacky solution that I don't like:

rspec:
  script:
    - pushd . && uru 233 && popd && set HOME=c:\ && ruby -v && bundle install && bundle exec rspec

rubocop:
  script:
    - pushd . && uru 233 && popd && set HOME=c:\ && ruby -v && bundle install && bundle exec rubocop

flay:
  script:
    - pushd . && uru 233 && popd && set HOME=c:\ && ruby -v && bundle install && bundle exec flay *


People sending comments have also prompted me to add that in Windows it seems to be stopping at the first array element in every script session.

With a Docker configuration for the runner I can do things like:

my_job_name:
  script:
    - a command
    - another command


With the windows shell runner it just stops after a command if I do it this way. Stringing the commands together seemed to work, but I would rather not have to put everything on one line.

Solution

stages are required

stages:
  - stage1

stage1:
  stage: stage1
  script:
    - echo hello


Could you try the following:

before_script:
  - pushd . && uru 233 && popd && set HOME=c:\ && ruby -v && bundle install

stages:
  - rspec
  - rubocop
  - flay

rspec:
  stage: rspec
  script:
    - bundle exec rspec

rubocop:
  stage: rubocop
  script:
    - bundle exec rubocop

flay:
  stage: flay
  script:
    - bundle exec flay *

Code Snippets

stages:
  - stage1

stage1:
  stage: stage1
  script:
    - echo hello
before_script:
  - pushd . && uru 233 && popd && set HOME=c:\ && ruby -v && bundle install

stages:
  - rspec
  - rubocop
  - flay

rspec:
  stage: rspec
  script:
    - bundle exec rspec

rubocop:
  stage: rubocop
  script:
    - bundle exec rubocop

flay:
  stage: flay
  script:
    - bundle exec flay *

Context

StackExchange DevOps Q#2086, answer score: 4

Revisions (0)

No revisions yet.