Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-17844

'Tool Home' does not expand environment variables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • customtools-plugin
    • None

      'Tool Home' does not appear to process environment variables or ~ ($HOME). I'd like to be specifying Tool Home to be ~/.rvm but it doesn't appear to be possible - instead it expands to: /Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/ruby-1.9.3/~/.rvm

      More details: I'm trying to set up a tool which will install rvm, ruby, and bundler. My slave hosts are a mix of Linux (centos) and Mac OS X. RVM's default behavior (and one that I'm relying on) is to install to $HOME/.rvm. Of course, on Linux this is /home/jenkins and on Mac this is /Users/jenkins.

      Install script:

      if ! which rvm > /dev/null; then
          echo "Installing RVM"
          curl -kL https://get.rvm.io | bash -s stable --ruby
      fi
      
      if type -t rvm | head -n1 | grep -v 'function' > /dev/null; then
          JENKINS_RVM_PATH="$HOME/.rvm/scripts/rvm"
          source "$JENKINS_RVM_PATH"
      fi
      
      if ! ruby --version | grep 1.9.3p362 > /dev/null ; then
          if ! rvm use 1.9.3-p362 > /dev/null; then
              echo "Installing ruby 1.9.3"
              rvm install 1.9.3-p362
          fi
          rvm use 1.9.3-p362
      fi
      
      if ! which bundle > /dev/null; then
          echo "Installing bundler"
          gem install bundler
      fi
      

      Build log:

      Started by user mdougherty
      [ruby-1.9.3] $ sh -e /Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/ruby-1.9.3/hudson7360731141557268923.sh
      ruby-1.9.3 is installed at /Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/ruby-1.9.3/~/.rvm
      FATAL: /Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/ruby-1.9.3/~/.rvm does not exist.
      /Users/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/ruby-1.9.3/~/.rvm does not exist.
      	at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:483)
      	at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:460)
      	at com.cloudbees.jenkins.plugins.customtools.CustomTool$1.invoke(CustomTool.java:136)
      	at com.cloudbees.jenkins.plugins.customtools.CustomTool$1.invoke(CustomTool.java:131)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2348)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:326)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:680)
      

            oleg_nenashev Oleg Nenashev
            mikedougherty Mike Dougherty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: