为什么“捆绑安装”为此“ gem env”需要“ sudo”?

时间:2018-08-06 16:48:13

标签: jenkins bundler

Jenkins管道的相关输出:

+ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.14
  - RUBY VERSION: 2.4.2 (2017-09-14 patchlevel 198) [x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Users/jenkins/.rbenv/shims
  - USER INSTALLATION DIRECTORY: /Users/jenkins/.gem/ruby/2.4.0
  - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/jenkins/.rbenv/shims/bin
  - SPEC CACHE DIRECTORY: /Users/jenkins/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.4.2_1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-16
  - GEM PATHS:
     - /Users/jenkins/.rbenv/shims
     - /Users/jenkins/.gem/ruby/2.4.0
     - /usr/local/lib/ruby/gems/2.4.0
     - /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/gems/2.4.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["https://artifactory.xxx.com/artifactory/api/gems/gems/"]
  - REMOTE SOURCES:
     - https://artifactory.xxx.com/artifactory/api/gems/gems/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Users/jenkins/.rbenv/shims
     - /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
     - /Users/jenkins/Library/Android/sdk
     - /Users/jenkins/tools/sonar-scanner-2.7/bin
     - /opt/apache-maven-3.5.3/bin
     - /opt/gradle/gradle-3.4.1/bin
     - /usr/local/lib/python2.7/bin
[Pipeline] sh
[App] Running shell script
+ rbenv install -s
[Pipeline] sh
[App] Running shell script
+ gem install bundler
Successfully installed bundler-1.16.3
Parsing documentation for bundler-1.16.3
Done installing documentation for bundler after 4 seconds
1 gem installed
[Pipeline] sh
[App] Running shell script
+ bundle install
Fetching gem metadata from http://rubygems.org/..........
RubyGems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to RubyGems 2.1.0 or higher to enable parallel gem installation.
Fetching CFPropertyList 3.0.0
sudo: no tty present and no askpass program specified
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.
An error occurred while installing CFPropertyList (3.0.0), and Bundler cannot
continue.
Make sure that `gem install CFPropertyList -v '3.0.0' --source
'http://rubygems.org/'` succeeds before bundling.

In Gemfile:
  fastlane was resolved to 2.101.1, which depends on
    simctl was resolved to 1.6.5, which depends on
      CFPropertyList

我们可以看到安装目录不是系统路径,而是用户主目录下的路径。那么为什么bundle install导致了这一点:

sudo: no tty present and no askpass program specified
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.
An error occurred while installing CFPropertyList (3.0.0), and Bundler cannot
continue.

0 个答案:

没有答案