3

Using MacOS-10.14.3, there is a problem with my GitLab CI for an iOS project (using fastlane):

I try to create a gitlab-runner on my Mac and I get quite far with it, except the following error message occurs during CI-failure:

enter image description here enter image description here

It seems that the error happens at the before_script for some reason.

Any idea what could be wrong here ?

From the fastlane page, I follow these instructions: Link

The Gitlab error seems to be related to a Ruby issue on Mac

I followed this suggestion here: I tried to re-install ruby, doing the following in a Terminal:

brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

But that did not help anything...

In case, interested, finding out what ruby is on my Mac:

ruby -v
ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin18]
which ruby
/usr/local/opt/ruby/bin/ruby

I use docker with image alpine:latest and I run my gitlab-runner from a Mac-Terminal with the following command:

sudo gitlab-runner run

Here is my Gemfile:

source 'https://rubygems.org'

gem 'fastlane'
gem 'cocoapods'

...and here is my gitlab-ci.yml file:

stages:
  - unit_tests
  - test_flight

variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"

before_script:
  - gem install bundler
  - bundle install

unit_tests:
  dependencies: []
  stage: unit_tests
  artifacts:
    paths:
      - fastlane/screenshots
      - fastlane/logs
  script:
    - fastlane tests
  tags:
    - ios

test_flight_build:
  dependencies: []
  stage: test_flight
  artifacts:
    paths:
      - fastlane/screenshots
      - fastlane/logs
  script:
    - fastlane testflight
  tags:
    - ios
  only:
     - /^release-.*$/
     - master

Any idea on how to change this GitLab CI File (or do anything else) so that this annoying gem install bundler error goes away ?? Any help appreciated.

iKK
  • 6,394
  • 10
  • 58
  • 131
  • Maybe you could try modifying the script to add a - echo $PATH and - which ruby to make sure that it is using the correct one – Gorille Mar 26 '19 at 13:55
  • I am not really familiar with such kind of scripts. Could you please be a bit more specific ? And, thank you very much for your support. How would such a `PATH` look like ? Do you have an example of this `echo $PATH` script ? – iKK Mar 26 '19 at 14:12
  • Could another docker image help ? Does anybody know how to set up GitLab CI on a Mac ?? – iKK Mar 26 '19 at 14:26
  • Did you try using ruby image for docker? https://hub.docker.com/_/ruby – tejasbubane Mar 26 '19 at 14:33
  • no, haven't tried this. I tried: `docker pull ruby`. But how do I start this ruby-docker image ?? (sorry but I am new to docker, gitlab, ci) – iKK Mar 26 '19 at 15:10
  • Now it worked !! I did reset the docker, made sure I re-did the `sudo gitlab-runner register` steps (but this time with the `ruby:2.6` docker image). And I am not sure if `docker pull ruby` was also necessary. Anyway, not really sure what's going on, I have a working docker image and can start the gitlab ci by writing `sudo gitlab-runner run` – iKK Mar 26 '19 at 15:29

0 Answers0