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

global environment variables are not expanded (interpolated) in pipelines

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      On Freestyle jobs defining a Jenkins global variable like this would work as expected:

      XDG_CACHE_HOME=${HOME}/.cache/${EXECUTOR_NUMBER}
      

      Note: behavior is the same regardless if brackets are used or not when you define the variables.

       

      Freestyle "set" result (correct):

      XDG_CACHE_HOME=/home/builder/.cache/2
      

      Pipeline "set" result (incorrect):

      XDG_CACHE_HOME=${HOME}/.cache/${EXECUTOR_NUMBER}
      

       

      This problem is essential because it prevents Jenkins administrators from using environment variables to fix/workaround execution problems. 

      Effectively this breaks any job that needs to define variables that are relative to something else, like workspace, home, ....

        Attachments

          Activity

          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          Do you have EnvInject plugin installed? IIRC Global Env Vars get resolved in such way only if the plugin is installed, but I am not 100% sure.

          Show
          oleg_nenashev Oleg Nenashev added a comment - Do you have EnvInject plugin installed? IIRC Global Env Vars get resolved in such way only if the plugin is installed, but I am not 100% sure.
          Hide
          ssbarnea Sorin Sbarnea added a comment -

          Yes, EnvInject plugin is installed but we are not using it.

          Show
          ssbarnea Sorin Sbarnea added a comment - Yes, EnvInject plugin is installed but we are not using it.
          Hide
          oleg_nenashev Oleg Nenashev added a comment -

          It impacts the environment resolution anyway IIRC

          Show
          oleg_nenashev Oleg Nenashev added a comment - It impacts the environment resolution anyway IIRC
          Hide
          ssbarnea Sorin Sbarnea added a comment -

          Glad to see that a fix is in review. A link to PR would have being useful too.

          Show
          ssbarnea Sorin Sbarnea added a comment - Glad to see that a fix is in review. A link to PR would have being useful too.

            People

            • Assignee:
              Unassigned
              Reporter:
              ssbarnea Sorin Sbarnea
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: