Jenkins Build Job Failed due to Ruby Gem Error

We have Jenkins build job with the ruby script. We want to require one gem(require 'net/ssh'). This gem failed while running via Jenkins. But Succeed while running in Jenkins Servers.

/usr/local/rvm/scripts/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require': cannot load such file -- net/ssh (LoadError) from /usr/local/rvm/scripts/rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in require' from /var/lib/jenkins/workspace/auto-sync/automation/jenkins/database_bkup/database_bk.rb:2:in `' Build step 'Execute shell' marked build as failure

In local gem list

minitest (5.10.1) multipart-post (2.0.0) net-ssh (4.2.0) net-telnet (0.1.1) nokogiri (1.8.1) openssl (default: 2.0.3) power_assert (0.4.1) psych (default: 2.2.2)

RubyGems Environment:

  • RUBYGEMS VERSION: 2.6.11
  • RUBY VERSION: 2.4.1 (2017-03-22 patchlevel 111) [x86_64-linux]
  • INSTALLATION DIRECTORY: /usr/local/rvm/scripts/gems/ruby-2.4.1
  • USER INSTALLATION DIRECTORY: /var/lib/jenkins/.gem/ruby/2.4.0
  • RUBY EXECUTABLE: /usr/local/rvm/scripts/rubies/ruby-2.4.1/bin/ruby
  • EXECUTABLE DIRECTORY: /usr/local/rvm/scripts/gems/ruby-2.4.1/bin
  • SPEC CACHE DIRECTORY: /var/lib/jenkins/.gem/specs
  • SYSTEM CONFIGURATION DIRECTORY: /etc

  • RUBYGEMS PLATFORMS:

  • ruby

  • x86_64-linux

  • GEM PATHS:

  • /usr/local/rvm/scripts/gems/ruby-2.4.1
  • /usr/local/rvm/scripts/gems/ruby-2.4.1@global
  • GEM CONFIGURATION:

  • :update_sources => true
  • :verbose => true
  • :backtrace => false
  • :bulk_threshold => 1000
  • REMOTE SOURCES:

  • https://rubygems.org/
  • SHELL PATH:

  • /usr/local/rvm/scripts/gems/ruby-2.4.1/bin
  • /usr/local/rvm/scripts/gems/ruby-2.4.1@global/bin
  • /usr/local/rvm/scripts/rubies/ruby-2.4.1/bin
  • /usr/local/rvm/scripts/bin
  • /var/lib/jenkins/.sdkman/candidates/grails/current/bin
  • /usr/local/sbin
  • /usr/local/bin
  • /usr/sbin
  • /usr/bin
  • /sbin
  • /bin
  • /snap/bin
  • 链接地址: http://www.djcxy.com/p/25282.html

    上一篇: 从Rakefile执行bash命令

    下一篇: 由于Ruby Gem错误,Jenkins构建作业失败