3

Is there a most recent and detailed-enough tutorial out there on how to set up a CI for an iOS project using Gitlab ?

I found many tutorials (see list below) - but it seems that things have changed at GitLab since these tutorials were made. Or they are simply not detailed and well-enough explained for me as a beginner. Therefore I wonder if there is a most accurate step-by-step explanation on how to set Gitlab-CI up for iOS on a Mac ?

In particular, I am looking for a Gitlab-CI step-by-step tutorial for an iOS project using Fastlane and having Cocoapods Dependencies.

Below you find the list of tutorials and pages that all say things about GitLab CI setup for iOS projects.

(I've followed all of them - but none is detailed enough for me as a beginner in CI or, really, is no longer accurate for 2019 and what GitLab represents today).

For all of the tutorials, I end up with Gitlab Pipeline errors.

Here a list of my open stackoverflow questions, each with its own Gitlab CI trial:

Concrete questions:

  1. can you use "docker" with Gitlab for iOS ? (or must it be "shell")
  2. do you need to use the "sudo" word or not for your gitlab-runner registration ? (why or why not)
  3. how do you set permissions on your Mac so that Gitlab CI works once you leave all sudo words out ?

Here is the list of tutorials I've found that explain Gitlab CI with iOS projects:

iKK
  • 6,394
  • 10
  • 58
  • 131
  • Hi @iKK, did you find any solution of this? – Krunal May 31 '22 at 13:30
  • uff sorry - no - it's been 3 years since I have last used GitLab. I do not have a solution today. But please check my [below response](https://stackoverflow.com/a/55424338/3826232) – iKK May 31 '22 at 17:09

1 Answers1

5

Here is the best tutorial on how to set up GitLab CI for an iOS-project that I have found.

Here are the findings that lead to a successful GitLab CI for an iOS-project:

  • It is especially important to recognise that as for an iOS-project, your GitLab CI must be registered as "shell" executor (not "docker").
  • Also, you are not allowed to use any sudo when dealing with the gitlab-runner. (no sudo allowed whatsoever since Apple wants you to have a user-mode connection with GitLab (and no system-mode as in a docker or else)...

The steps are as follows:

gitlab-runner stop (optional if already previous trials...)

gitlab-runner uninstall (optional if already previous trials...)

gitlab-runner register \
  --non-interactive \
  --url "https://gitlab.com/" \
  --registration-token "ABCDEFG21sadfSAEGEAERE" \
  --description "MyApp runner with shell" \
  --tag-list ios \
  --executor "shell"

(feel free to use different tags. Also, the token can be found under the GitLab page-->under Settings-->CI/CD-->Runner expand)

gitlab-runner install

gitlab-runner start

Furthermore, it turned out that the "permission denied" error on my GitLab Pipeline had nothing to do with GitLab itself - but was due to a Ruby version mismatch on my Mac that I connected with the gitlab-runner.

I was able to update my Ruby version with the help of this post (i.e. using chruby). There are other possibilities out there on how to update Ruby on your Mac.

It is important to understand that GitLab requires your Mac to have a stable Ruby environment.

iKK
  • 6,394
  • 10
  • 58
  • 131