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.

  • Why do you chain commands with && ? May you share a log of one of your job failing ? – Tensibai Sep 20 '17 at 7: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
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 *
  • @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 7: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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.