4

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.

David West
  • 1,463
  • 3
  • 16
  • 25
  • Why do you chain commands with && ? May you share a log of one of your job failing ? – Tensibai Sep 20 '17 at 07:21
  • So that if a command fails it stops. I could use ; and just have it move on, but If don't want that. BTW I have things set up so my prompt us more like bash. Usually in vanilla Windows I see people using one & – David West Sep 20 '17 at 10:13
  • @Tensibai I'll look for the logs. – David West Sep 20 '17 at 10:19
  • or you could use an array in gitlab and don't need a so long and ugly line also – Tensibai Sep 20 '17 at 10:48
  • I did originally it seemed to be stopping at the first element in every array. – David West Sep 20 '17 at 10:50
  • Check your syntaxes then, either there's a problem with it or your runner is buggy. (check for tabs set instead of spaces mainly) – Tensibai Sep 20 '17 at 10:51
  • I have a feeling that it does the equivalent of a Linux exit 0 after it completes a command in every section. It was telling me my builds were passing and then I realized it didn't run anything past the first line with the windows shell runner. So I smooshed everything to one line. Then it worked, but it looked hacky. So I can I changed the runner so it runs inside a Ruby:2.3 Docker container. – David West Sep 20 '17 at 10:59
  • Without any log I can't tell, run the pipeline in debug and share it if you want a better feedback, could be 1 bug in the windows runner – Tensibai Sep 20 '17 at 12:47

1 Answers1

4

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 *
030
  • 13,235
  • 16
  • 74
  • 173
  • @Pierre.Vriens the answer has been updated – 030 Sep 19 '17 at 16:07
  • Voilà, veel beter! – Pierre.Vriens Sep 19 '17 at 16:20
  • That doesn't make much sense, if no stages are defined then build/test/deploy stages are available and a job with no stage defined is automatically linked to the test stage. – Tensibai Sep 20 '17 at 07:16
  • I've since put stages on, since I started keeping artifacts and have a section in deploy to Gitlab Pages (now I have to get the admin to enable pages which is 'low priority'). I will try adding in before_stage again today. We are also changing the nodes and using Docker, though. I'd like to report that Docker never had this problem. – David West Sep 20 '17 at 10:17