Gitlab CI-CD using fastlane 安装rake(13.0.6)时出错,Bundler无法继续

Gitlab CI-CD using Fastlane An error occurred while installing rake (13.0.6), and Bundler cannot continue

我正在尝试使用 Fastlane 集成 CI-CD,所有通道在我的个人笔记本电脑上都运行良好,但是当我尝试将它推送到我的 repo 上并在工作开始后显示以下错误

我的 .gitlab.ci.yml 文件是

变量: GIT_STRATEGY: 获取 LC_ALL: "en_US.UTF-8" 朗:"en_US.UTF-8"

阶段:

before_script:

棉绒: 阶段:lint 脚本: - 快车道皮棉 标签: - ios-标签

unit_tests: 舞台:unit_tests 脚本: - 快车道测试 标签: - ios-标签

archive_project: 阶段:存档 脚本: - 快速通道分发 标签: - ios-标签

当我尝试执行作业时,它显示了上述错误

考虑到 rvm 是否引起了一些问题,我也删除了我的 .bash_profile 中写的所有内容

下面是我尝试 运行 GitLab 上的作业时的完整控制台输出:

Running with gitlab-runner 14.10.0 (c6bb62f6) on demo for ci-cd iQtGJP4Z Preparing the "shell" executor 00:00 Using Shell executor... Preparing environment 00:00 Running on xxxxxxxx082... Getting source from Git repository 00:02 Fetching changes with git depth set to 20... Reinitialized existing Git repository in /Users/Mohit.Pareek/Documents/CI-CD-Demo/builds/iQtGJP4Z/0/mohit.pareek/ci-cd-demo/.git/ Checking out e699b9da as main... Skipping Git submodules setup Executing "step_script" stage of the job script 00:16 $ bundle install Fetching gem metadata from https://rubygems.org/....... Following files may not be writable, so sudo is needed: /Library/Ruby/Gems/2.6.0 /Library/Ruby/Gems/2.6.0/build_info /Library/Ruby/Gems/2.6.0/bundler /Library/Ruby/Gems/2.6.0/cache /Library/Ruby/Gems/2.6.0/doc /Library/Ruby/Gems/2.6.0/extensions /Library/Ruby/Gems/2.6.0/gems /Library/Ruby/Gems/2.6.0/specifications Fetching rake 13.0.6 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Using rexml 3.2.5 Using concurrent-ruby 1.1.10 Using minitest 5.15.0 Using zeitwerk 2.5.4 Using httpclient 2.8.3 Using atomos 0.1.3 Using bundler 2.3.10 Fetching jmespath 1.6.1 Fetching public_suffix 4.0.7 Fetching json 2.6.1 Fetching artifactory 3.0.15 Fetching aws-partitions 1.587.0 Fetching aws-eventstream 1.2.0 Fetching babosa 1.0.4 Using claide 1.1.0 Using fuzzy_match 2.0.4 Using nap 1.1.0 Using netrc 0.11.0 Using cocoapods-deintegrate 1.0.5 Using cocoapods-downloader 1.6.3 Fetching ffi 1.15.5 Using cocoapods-try 1.2.0 Using escape 0.0.4 Using cocoapods-search 1.0.1 Using colored2 3.1.2 Using fourflusher 2.3.1 Using nanaimo 0.3.0 Using gh_inspector 1.1.3 Using molinillo 0.8.0 Using ruby-macho 2.5.1 Fetching colored 1.2 Fetching highline 2.0.3 Fetching unf_ext 0.0.8.1 Fetching declarative 0.0.20 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching dotenv 2.7.6 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching emoji_regex 3.2.3 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching excon 0.92.3 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-em_http 1.0.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-em_synchrony 1.0.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-excon 1.1.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-httpclient 1.0.1 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching multipart-post 2.0.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-net_http 1.0.1 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-net_http_persistent 1.2.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-patron 1.0.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-rack 1.0.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching faraday-retry 1.0.3 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching ruby2_keywords 0.0.5 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching fastimage 2.2.6 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching jwt 2.3.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching memoist 0.16.2 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching multi_json 1.15.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching os 1.1.4 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching mini_mime 1.1.2 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching trailblazer-option 0.1.2 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching uber 0.1.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching retriable 3.1.2 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching webrick 1.7.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching google-cloud-errors 1.2.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching mini_magick 4.11.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching naturally 2.2.1 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching optparse 0.1.1 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching plist 3.6.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching rubyzip 2.3.2 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching security 0.1.3 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching terminal-notifier 2.0.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching unicode-display_width 1.8.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching tty-screen 0.8.1 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching tty-cursor 0.7.1 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching word_wrap 1.0.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Using rouge 2.0.7 Fetching fastlane-plugin-firebase_app_distribution 0.3.4 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching slack-notifier 2.4.0 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Fetching xcresult 0.2.1 sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper sudo: a password is required Bundler::SudoNotPermittedError: Bundler requires sudo access to install at the moment. Try installing again, granting Bundler sudo access when prompted, or installing into a different path. /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler.rb:547:in block in sudo' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler.rb:532:in synchronize' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler.rb:532:in sudo' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/source/rubygems.rb:485:in fetch_gem' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/source/rubygems.rb:165:in install' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer/gem_installer.rb:54:in install' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer/gem_installer.rb:16:in install_from_spec' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer/parallel_installer.rb:186:in do_install' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer/parallel_installer.rb:90:in call' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer/parallel_installer.rb:71:in call' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer.rb:259:in install_in_parallel' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer.rb:209:in install' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer.rb:89:in block in run' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/process_lock.rb:19:in rescue in lock' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/process_lock.rb:15:in lock' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer.rb:71:in run' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/installer.rb:23:in install' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/cli/install.rb:62:in run' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/cli.rb:255:in block in install' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/settings.rb:131:in temporary' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/cli.rb:254:in install' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor.rb:392:in dispatch' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/cli.rb:31:in dispatch' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/vendor/thor/lib/thor/base.rb:485:in start' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/cli.rb:25:in start' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/exe/bundle:48:in block in ' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/lib/bundler/friendly_errors.rb:103:in with_friendly_errors' /Library/Ruby/Gems/2.6.0/gems/bundler-2.3.10/exe/bundle:36:in ' /usr/local/bin/bundle:23:in load' /usr/local/bin/bundle:23:in ' An error occurred while installing rake (13.0.6), and Bundler cannot continue. In Gemfile: xcov was resolved to 1.8.1, which depends on fastlane was resolved to 2.205.2, which depends on google-cloud-storage was resolved to 1.36.2, which depends on digest-crc was resolved to 0.6.4, which depends on rake ERROR: Job failed: exit status 1 lint

Duration: 18 seconds Finished: 20 hours ago Timeout: 1h (from project)

Runner: #8 (iQtGJP4Z) demo for ci-cd Tags: ios-tag

Commit e699b9da fasfzf

Pipeline #37641 for main lint

我假设正在使用的运行器是 shell 运行器,因为您在安装 gems 时遇到问题(例如 - Bundler requires sudo access to install at the moment)。

我建议安装 Docker 和 registering a runner using the docker executor. Then, update your gitlab-ci.yml to use a Ruby docker image

我终于找到问题了。 基本上,没有访问权限。所以我刚刚为那个特定的存储库上传了我的 public ssh 密钥 gitlab->your_project->settings->repository->deploy keys

它解决了我的问题。 另外我会建议从 rvm 移动到 rbenv用于管理 ruby