这是我使用 Jenkins 运行时 fastlane env 命令的输出。
SDK 和快速通道设置位于 Docker 容器中。
[09:11:28]: [33mGet started using a Gemfile for fastlane https://docs.fastlane.tools/getting-started/ios/setup/#use-a-gemfile[0m
`/` is not writable.
Bundler will use `/tmp/bundler20200228-96-c24ujz96' as your home directory temporarily.
/usr/lib/ruby/2.5.0/fileutils.rb:232:in `mkdir': [31m[!] Permission denied @ dir_s_mkdir - /.fastlane[0m (Errno::EACCES)
from /usr/lib/ruby/2.5.0/fileutils.rb:232:in `fu_mkdir'
from /usr/lib/ruby/2.5.0/fileutils.rb:210:in `block (2 levels) in mkdir_p'
from /usr/lib/ruby/2.5.0/fileutils.rb:208:in `reverse_each'
from /usr/lib/ruby/2.5.0/fileutils.rb:208:in `block in mkdir_p'
from /usr/lib/ruby/2.5.0/fileutils.rb:193:in `each'
from /usr/lib/ruby/2.5.0/fileutils.rb:193:in `mkdir_p'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/fastlane_core/lib/fastlane_core/module.rb:28:in `fastlane_user_dir'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb:58:in `did_show_message?'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb:22:in `action_launched'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:74:in `run!'
from /var/lib/gems/2.5.0/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/commands_generator.rb:349:in `run'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
from /var/lib/gems/2.5.0/gems/fastlane-2.141.0/bin/fastlane:23:in `<top (required)>'
from /usr/local/bin/fastlane:23:in `load'
from /usr/local/bin/fastlane:23:in `<main>'
尝试在 Dockerfile 中设置以下 env var:
GEM_HOME=/bundle
ENV BUNDLE_PATH $GEM_HOME
ENV BUNDLE_APP_CONFIG=$BUNDLE_PATH
BUNDLE_BIN=$BUNDLE_PATH/bin
ENV PATH $BUNDLE_BIN:$PATH
然后,当您运行bundle
时,它应该使用正确的目录进行安装。