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

Rooted path variables for tool home isn't treated as an absolute path

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: customtools-plugin
    • Labels:
    • Environment:
      Host: OpenJDK 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14 running Jenkins 2.32.1 w/customtools-plugin 0.4.4
      Build Agent: Windows 10 (x86) Connected via JNLP agent.
    • Similar Issues:

      Description

      When using an environment variable to define the prefix for a custom tool home, such as ${LOCALAPPDATA}, the default home location is still appended to the tool home when it shouldn't be.

      For example, I have a custom tool called 'mytool' with a trivial batch script installer:

      @echo off
      echo Installed mytool

      and a custom tool home location of ${PROGRAMDATA}

      I created a simple pipeline which is:

      node('win') {
      bat " echo ${tool 'mytool'} "
      }

      The expected relevant output should be C:\ProgramData, but is C:\Jenkins\tools\com.cloudbees.jenkins.plugins.customtools.CustomTool\mytool\C:\ProgramData

      If I manually resolve C:\ProgramData as the tool home (that is, I made the tool home location literally "C:\ProgramData"), then the tool home is configured correctly and outputs only "C:\ProgramData". For some installers, this is acceptable, however I need to use the LocalAppData directory, which contains the username of the build agent. I haven't been able to find a workaround that tricks the tool home into thinking it's rooted path.

      I was able to reproduce this issue using the same methodology on both the host build agent, Ubuntu, and on a remote build agent, Windows. Let me know if there's anything I can do to help out.

        Attachments

          Activity

          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Formally Custom Tools plugin does not support Pipeline now. There may be such glitches in Pipeline specifically (or just a wider bug). Please provide full configurations of your custom tools plugin, Pipeline. It would be also useful to know version of the Pipeline plugin

          Show
          oleg_nenashev Oleg Nenashev added a comment - Formally Custom Tools plugin does not support Pipeline now. There may be such glitches in Pipeline specifically (or just a wider bug). Please provide full configurations of your custom tools plugin, Pipeline. It would be also useful to know version of the Pipeline plugin
          Hide
          edjubuh Elliot Berman added a comment -

          I was able to reproduce the same issue with a Freestyle project. I required the installation of python3 as specified below on a linux node and added a shell script to `printenv`.

          Here is a screenshot of the relevant configuration for installing python3 (full config linked below):

          The actual build configuration was:

          with an additional restriction to only allow the script to run on nodes labeled `linux`

          For my freestyle project, the results were the same as described in my original post. The resulting tool home path was `/var/lib/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/python3/var/lib/jenkins` not `/var/lib/jenkins`

          I copied my system configuration here: https://gist.github.com/edjubuh/7f65c13468834b35ed6d317b42675675 which indicates plugin versions and my full CustomTool.xml file

          Show
          edjubuh Elliot Berman added a comment - I was able to reproduce the same issue with a Freestyle project. I required the installation of python3 as specified below on a linux node and added a shell script to `printenv`. Here is a screenshot of the relevant configuration for installing python3 (full config linked below): The actual build configuration was: with an additional restriction to only allow the script to run on nodes labeled `linux` For my freestyle project, the results were the same as described in my original post. The resulting tool home path was `/var/lib/jenkins/tools/com.cloudbees.jenkins.plugins.customtools.CustomTool/python3/var/lib/jenkins` not `/var/lib/jenkins` I copied my system configuration here: https://gist.github.com/edjubuh/7f65c13468834b35ed6d317b42675675 which indicates plugin versions and my full CustomTool.xml file
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          It's likely a bug in the Tool Installer implementation, so it rather a question to the Jenkins core. Will try to verify, but no commitment to do it soon. Maybe usage/patch of https://wiki.jenkins-ci.org/display/JENKINS/Extra+Tool+Installers+Plugin could be a workaround. There I was definitely using absolute paths coming from variables

          Show
          oleg_nenashev Oleg Nenashev added a comment - It's likely a bug in the Tool Installer implementation, so it rather a question to the Jenkins core. Will try to verify, but no commitment to do it soon. Maybe usage/patch of https://wiki.jenkins-ci.org/display/JENKINS/Extra+Tool+Installers+Plugin could be a workaround. There I was definitely using absolute paths coming from variables
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          I will have a really small bandwith in the community in the next months, see https://groups.google.com/d/msg/jenkinsci-dev/uc6NsMoCFQI/AIO4WG1UCwAJ for the context. I decided to mark this plugin for adoption and unassigned tickets so that anybody is welcome to take over the plugin and to become a maintainer. Some tickets already have pending pull requests which can be finalized.

          Show
          oleg_nenashev Oleg Nenashev added a comment - I will have a really small bandwith in the community in the next months, see https://groups.google.com/d/msg/jenkinsci-dev/uc6NsMoCFQI/AIO4WG1UCwAJ for the context. I decided to mark this plugin for adoption and unassigned tickets so that anybody is welcome to take over the plugin and to become a maintainer. Some tickets already have pending pull requests which can be finalized.

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            edjubuh Elliot Berman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated: