GitLab CI: iOS project issue (permission denied)

时光毁灭记忆、已成空白 提交于 2019-12-18 09:43:31

问题


Trying GitLab CI for my iOS project, I follow this, this and this tutorial.

Two questions:

  1. What is wrong with my gitlab-runner (with "shell" registration) since GitLab CI throws the following error:
Running with gitlab-runner 11.9.0 (692ae235)
  on MyApp runner with shell DsaBC-oQ
Using Shell executor...
Running on MyComputer.network.provider...
mkdir: /Users/myusername/builds/DsaBC-oQ/0/username/myproj.tmp: Permission denied
mkdir: /Users/myusername/builds/DsaBC-oQ/0/username/myproj.tmp: Permission denied
ERROR: Job failed: exit status 1
  1. Some people say to use "sudo" for the gitlab-runner registration. But then I would need "docker". But it seems that "docker" can't be used for an iOS project in GitLab (but only "shell" registration). Is this true ? (if no, how does the gitlab-runner registration cmd look like exactly for a docker registration ??). Does "docker" work for an iOS-project at all using GitLab ??

Here is my .gitlab-ci.yml file:

stages:
  - unit_tests

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:
    - bundle exec fastlane tests
  tags:
    - ios

I tried to register the gitlab-runner as follows:

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

The "shell" trial make Gitlab-CI show the above mentioned error (i.e. permission denied)

And I also tried to register the gitlab-runner with docker:

gitlab-runner register \
  --non-interactive \
  --url "https://gitlab.com/" \
  --registration-token "TOKENABCEDF" \
  --description "MyApp runner with docker and ruby-2.6” \
  --tag-list ios \
  --executor "docker" \
  --docker-image ruby:2.6

But the "docker" trial made the GitLab-CI show another error (i.e. [!] You cannot run CocoaPods as root) as explained in more detail here...

Any idea on how to make this GitLab-CI for an iOS-project finally work properly at all ?? Thanks for any hint. (after 3 days of trials I am more than desperate for this to work)...


回答1:


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.

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



来源:https://stackoverflow.com/questions/55399687/gitlab-ci-ios-project-issue-permission-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!