GitLab CI:iOS项目问题(权限被拒绝) [英] GitLab CI: iOS project issue (permission denied)

查看:193
本文介绍了GitLab CI:iOS项目问题(权限被拒绝)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在为我的iOS项目尝试GitLab CI时,我遵循教程.

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

两个问题:

  1. 由于GitLab CI抛出以下错误,我的gitlab-runner(注册了"shell")出了什么问题?

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. 有人说使用"sudo"进行gitlab-runner注册.但是然后我需要"docker".但是,似乎"docker"不能用于GitLab中的iOS项目(只能使用"shell"注册).这是真的 ? (如果否,则gitlab-runner注册cmd看起来与docker注册完全一样??).使用GitLab,"docker"是否完全适用于iOS项目?

这是我的.gitlab-ci.yml文件:

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

我试图按如下方式注册gitlab-runner:

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"

"shell"试验使Gitlab-CI显示上述错误(即permission denied)

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

我还尝试向docker注册gitlab-runner:

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

但是"docker"试验使GitLab-CI出现了另一个错误(即[!] You cannot run CocoaPods as root),如更详细地解释的那样

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...

关于如何使此GitLab-CI用于iOS项目的任何想法最终都可以正常使用??感谢您的任何提示. (经过3天的试用,我非常渴望这样做)...

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)...

推荐答案

事实证明,我的GitLab管道上的权限被拒绝"错误与GitLab本身无关-但这是由于Mac上的Ruby版本不匹配我连接了gitlab-runner.

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.

借助这篇文章,我能够更新Ruby版本 (即使用chruby).关于如何在Mac上更新Ruby,还有其他可能性.重要的是要了解GitLab需要Mac拥有稳定的Ruby环境.

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.

作为旁注: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆