puppetlabs/puppet — pull request #1055 by jeffmccune (2012-08-20 22:14:30+00:00)
Title: (#15464) Exclude gem command from rubygems-bundler

Without this patch the gem command will load and execute the Gemfile
automatically at http://jenkins.puppetlabs.com. This is a problem because
the jobs do not satisfy rubygems dependencies, only ruby library
dependencies using `$LOAD_PATH`.

For whatever reason the cd() bash function created by rvm will pick up a
Gemfile as if it were an .rvmrc file in the current directory. This is a
problem because we're running with `set -e` in our CI system. Evidently
putting a comment of `#ruby=1.9.3@project` or something similar changes
the behavior of the cd() function. [1]

[1] [.rvmrc are not load in subdirectories with
Gemfile](https://github.com/wayneeseguin/rvm/issues/911)

This showed up in the CI system as having exited out around this point in
the job script:

+ typeset _bundler_version
+ __rvm_ensure_is_a_function
+ [[ 0 == 1 ]]
+ is_a_function rvm
+ typeset -f rvm
++ __rvm_env_string
++ typeset _path _string
++ _path=/home/jenkins/.rvm/gems/ruby-1.8.7-p358@noFeatures
++ _string=ruby-1.8.7-p358@noFeatures
++ _string=ruby-1.8.7-p358@noFeatures
++ printf %b ruby-1.8.7-p358@noFeatures
+ rvm_previous_environment=ruby-1.8.7-p358@noFeatures
+ rvm_current_rvmrc='/mnt/workspace/jeff Puppet Specs (2.7.x)/gemset/@noFeatures/ruby/ruby-1.8.7-p358/rvm/#rvm/Gemfile'
++ sed -n '/^#ruby=/ {s/#ruby=//;p;}'
+ rvm_ruby_string=
+ [[ -n '' ]]
+ return 2
+ rvm_trustworthiness_result=2
+ unset __rvm_project_rvmrc_lock
+ return 2
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Note, the noexec and the Gemfile change does not actually fix the problem.
The change in the job configuration to disable per-project RVM RC files
is what actually fixes the problem.

This change is:

if ! grep -qx rvm_project_rvmrc=0 ~/.rvmrc; then
echo rvm_project_rvmrc=0 >> ~/.rvmrc
fi