When both the NodeJS and RVM plugins are enabled for a single build, the build fails to run. It appears that the PATH accessible to the RVM plugin when it is setting up the environment is incorrect. We have used each of the plugins separately in our environment and they work fine.

      Here is example output from a build with nothing defined in it apart from enabling the two plugins.

      Started by user Ben Butler-Cole
      [EnvInject] - Loading node environment variables.
      Building remotely on civm02 in workspace /var/tmp/workspace/bbc-test
      Capturing environment variables produced by 'rvm use 1.9.3@release'
      $ bash -c export
      $ bash -c "test -f ~/.rvm/scripts/rvm"
      [bbc-test] $ bash -c " source ~/.rvm/scripts/rvm && rvm use --install --create 1.9.3@release && export > rvm.env"
      /home/ubuntu/.rvm/scripts/rvm: line 67: dirname: command not found
      /home/ubuntu/.rvm/scripts/rvm: line 96: dirname: command not found
      ERROR: Missing proper 'which' command. Make sure it is installed before using RVM!
      ERROR: Failed to setup RVM environment
      [BFA] Scanning build for known causes...
      
      [BFA] Done. 0s
      Notifying upstream projects of job completion
      Finished: FAILURE
      

      I have attached the system info for our system.

          [JENKINS-20636] RVM and NodeJS plugins are incompatible

          I've had the same experience with rbenv plugin.

          Started by user Vanja Radovanović
          [EnvInject] - Loading node environment variables.
          Building remotely on ci-clave (available linux) in workspace /opt/jenkins/workspace/test-project
          Wiping out workspace first.
          Cloning the remote Git repository
          Cleaning workspace
          $ bash -c "[ -d \$HOME/.rbenv ]"
          $ bash -c "[ -d \$HOME/.rbenv/plugins/ruby-build ]"
          Just ignoring local Ruby version.
          $ bash -c "mkdir \$HOME/.rbenv.lock"
          $ bash -c "mkdir \$HOME/.rbenv.lock"
          $ bash -c "mkdir \$HOME/.rbenv.lock"
          .....
          $ bash -c "mkdir \$HOME/.rbenv.lock"
          ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com
          org.jruby.exceptions.RaiseException: (LockError) could not acquire lock in 1000 seconds.
          at RUBY.release_lock(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:31)
          	at RUBY.synchronize(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:14)
          	at RUBY.setup!(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv.rb:24)
          	at RUBY.setup(C:/.jenkins/plugins/rbenv/WEB-INF/classes/models/rbenv_wrapper.rb:61)
          	at RUBY.setUp(C:/.jenkins/plugins/rbenv/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/model/environment_proxy.rb:8)
          project=hudson.maven.MavenModuleSet@9230959[test-project-module]
          project.getModules()=[hudson.maven.MavenModule@2d785573[test-project/org.test:test-project-module][test-project-module/org.test:test-project-module][relativePath:]]
          project.getRootModule()=hudson.maven.MavenModule@2d785573[test-project/org.test:test-project-module][test-project-module/org.test:test-project-module][relativePath:]
          FATAL: (LockError) could not release lock in 1000 secs.
          org.jruby.exceptions.RaiseException: (LockError) could not release lock in 1000 secs.
          	at RUBY.release_lock(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:44)
          	at RUBY.synchronize(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:17)
          	at RUBY.setup!(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv.rb:24)
          	at RUBY.setup(C:/.jenkins/plugins/rbenv/WEB-INF/classes/models/rbenv_wrapper.rb:61)
          	at RUBY.setUp(C:/.jenkins/plugins/rbenv/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/model/environment_proxy.rb:8)
          

          I've tried with an updated version of NodeJS plugin that uses jenkins parent 1.575 and maven-hpi-plugin 1.106 but without any luck.

          From what I see, rbenv plugin can execute native bash commands normally (e.g. directory location testing) but the PATH is not set for it so commands like mkdir, git, env and others just fail. When I turn off the NodeJS plugin from the job configuration, everything works as expected.

          We use Jenkins 1.575. The master is a windows machine and the slave is CentOS one.

          Vanja Radovanović added a comment - I've had the same experience with rbenv plugin. Started by user Vanja Radovanović [EnvInject] - Loading node environment variables. Building remotely on ci-clave (available linux) in workspace /opt/jenkins/workspace/test-project Wiping out workspace first. Cloning the remote Git repository Cleaning workspace $ bash -c "[ -d \$HOME/.rbenv ]" $ bash -c "[ -d \$HOME/.rbenv/plugins/ruby-build ]" Just ignoring local Ruby version. $ bash -c "mkdir \$HOME/.rbenv.lock" $ bash -c "mkdir \$HOME/.rbenv.lock" $ bash -c "mkdir \$HOME/.rbenv.lock" ..... $ bash -c "mkdir \$HOME/.rbenv.lock" ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com org.jruby.exceptions.RaiseException: (LockError) could not acquire lock in 1000 seconds. at RUBY.release_lock(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:31) at RUBY.synchronize(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:14) at RUBY.setup!(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv.rb:24) at RUBY.setup(C:/.jenkins/plugins/rbenv/WEB-INF/classes/models/rbenv_wrapper.rb:61) at RUBY.setUp(C:/.jenkins/plugins/rbenv/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/model/environment_proxy.rb:8) project=hudson.maven.MavenModuleSet@9230959[test-project-module] project.getModules()=[hudson.maven.MavenModule@2d785573[test-project/org.test:test-project-module][test-project-module/org.test:test-project-module][relativePath:]] project.getRootModule()=hudson.maven.MavenModule@2d785573[test-project/org.test:test-project-module][test-project-module/org.test:test-project-module][relativePath:] FATAL: (LockError) could not release lock in 1000 secs. org.jruby.exceptions.RaiseException: (LockError) could not release lock in 1000 secs. at RUBY.release_lock(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:44) at RUBY.synchronize(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv/semaphore.rb:17) at RUBY.setup!(C:/.jenkins/plugins/rbenv/WEB-INF/classes/lib/rbenv.rb:24) at RUBY.setup(C:/.jenkins/plugins/rbenv/WEB-INF/classes/models/rbenv_wrapper.rb:61) at RUBY.setUp(C:/.jenkins/plugins/rbenv/WEB-INF/classes/vendor/gems/gems/jenkins-plugin-runtime-0.2.3/lib/jenkins/model/environment_proxy.rb:8) I've tried with an updated version of NodeJS plugin that uses jenkins parent 1.575 and maven-hpi-plugin 1.106 but without any luck. From what I see, rbenv plugin can execute native bash commands normally (e.g. directory location testing) but the PATH is not set for it so commands like mkdir, git, env and others just fail. When I turn off the NodeJS plugin from the job configuration, everything works as expected. We use Jenkins 1.575. The master is a windows machine and the slave is CentOS one.

          Joe Hansche added a comment -

          kohsuke, is this an issue with the ruby runtime plugin? Or an issue with how the NodeJS plugin does its set up? The fact that both rbenv and RVM plugins have this issue, and both rely on the ruby runtime. NodeJS modifies the environment from the decorateLauncher() method, injecting the bin dir of the NodeJS installation into the PATH env var from the Launcher#launch(ProcStarter) method:

              @Override
              public Launcher decorateLauncher(final AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException {
                  return new DecoratedLauncher(launcher){
                      @Override
                      public Proc launch(ProcStarter starter) throws IOException {
          ...
          
                          // HACK: Avoids issue with invalid separators in EnvVars::override in case of different master/slave
                          
                          String overriddenPaths = NodeJSInstaller.binFolderOf(nodeJSInstallation, build.getBuiltOn())
                                  + pathSeparator
                                  + vars.get("PATH");
                          vars.override("PATH", overriddenPaths);
          
                          return super.launch(starter.envs(Util.mapToEnv(vars)));
                      }
          

          Could it be a threading issue between the NodeJS plugin and the ruby runtime?

          Joe Hansche added a comment - kohsuke , is this an issue with the ruby runtime plugin? Or an issue with how the NodeJS plugin does its set up? The fact that both rbenv and RVM plugins have this issue, and both rely on the ruby runtime. NodeJS modifies the environment from the decorateLauncher() method, injecting the bin dir of the NodeJS installation into the PATH env var from the Launcher#launch(ProcStarter) method: @Override public Launcher decorateLauncher( final AbstractBuild build, Launcher launcher, BuildListener listener) throws IOException, InterruptedException, Run.RunnerAbortedException { return new DecoratedLauncher(launcher){ @Override public Proc launch(ProcStarter starter) throws IOException { ... // HACK: Avoids issue with invalid separators in EnvVars::override in case of different master/slave String overriddenPaths = NodeJSInstaller.binFolderOf(nodeJSInstallation, build.getBuiltOn()) + pathSeparator + vars.get( "PATH" ); vars.override( "PATH" , overriddenPaths); return super .launch(starter.envs(Util.mapToEnv(vars))); } Could it be a threading issue between the NodeJS plugin and the ruby runtime?

          Sandra Thieme added a comment -

          This is still an issue for me. I can't have a build with both the NodeJS plugin and the Rvm (or Rbenv) plugin active:

          Capturing environment variables produced by 'rvm use 2.1.5'
          $ bash -c export
          $ bash -c "test -f ~/.rvm/scripts/rvm"
          [job-master] $ bash -c " source ~/.rvm/scripts/rvm && rvm use --install --create 2.1.5 && export > rvm.env"
          /var/lib/jenkins/.rvm/scripts/rvm: Line 12: uname: Command not found.
          /var/lib/jenkins/.rvm/scripts/rvm: Ling 15: ps: Command not found.
          bash: rvm: Command not found.
          

          During execution of the aforementioned rvm script, the PATH variable looks like this:

          /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_4.x/bin:null
          

          A solution for this issue would be very much appreciated, because it stops me from running some builds at all.

          Sandra Thieme added a comment - This is still an issue for me. I can't have a build with both the NodeJS plugin and the Rvm (or Rbenv) plugin active: Capturing environment variables produced by 'rvm use 2.1.5' $ bash -c export $ bash -c "test -f ~/.rvm/scripts/rvm" [job-master] $ bash -c " source ~/.rvm/scripts/rvm && rvm use --install --create 2.1.5 && export > rvm.env" /var/lib/jenkins/.rvm/scripts/rvm: Line 12: uname: Command not found. /var/lib/jenkins/.rvm/scripts/rvm: Ling 15: ps: Command not found. bash: rvm: Command not found. During execution of the aforementioned rvm script, the PATH variable looks like this: /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/NodeJS_4.x/bin:null A solution for this issue would be very much appreciated, because it stops me from running some builds at all.

          Eito Katagiri added a comment -

          It seems that this issue has been fixed in master of NodeJS plugin (https://github.com/jenkinsci/nodejs-plugin). Please try to build your own plugin or ask maintainer of NodeJS plugin to release new version.

          Eito Katagiri added a comment - It seems that this issue has been fixed in master of NodeJS plugin ( https://github.com/jenkinsci/nodejs-plugin ). Please try to build your own plugin or ask maintainer of NodeJS plugin to release new version.

          Sandra Thieme added a comment -

          Right, trying a build of the current master of the NodeJS plugin fixes this issue.

          fcamblor, could you create a new release of the NodeJS plugin?

          Sandra Thieme added a comment - Right, trying a build of the current master of the NodeJS plugin fixes this issue. fcamblor , could you create a new release of the NodeJS plugin?

          Nikolas Falco added a comment -

          Please update to the last release

          Nikolas Falco added a comment - Please update to the last release

          Nikolas Falco added a comment - - edited

          PATH enviroment is correctly setup using override method of EnvVars that append the PATH to the current PATH value.

          Pay attention to JENKINS-26583 caused by EnvInjectPlugin (appear in the issue log)

          Nikolas Falco added a comment - - edited PATH enviroment is correctly setup using override method of EnvVars that append the PATH to the current PATH value. Pay attention to JENKINS-26583 caused by EnvInjectPlugin (appear in the issue log)

            Unassigned Unassigned
            benbc Ben Butler-Cole
            Votes:
            6 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: