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

readProperties does not interpolate some vars

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      Master and Slave run each on a centOS VM
      Jenkins 2.121.3
      Pipeline-Utility-Steps : 2.2.0
    • Similar Issues:

      Description

      I have created a property files with vars either initialized to a constant value or to another var coming from the Jenkins instance global properties.
      Then, I create a Jenkinsfile starting with a node block which reads the property file :

      def myEnv
      node {
       myEnv=
      readProperties( file:fileName, interpolate:true )
      
      }
      pipeline {
       ...
      }
      

      Most of vars are correctly set as far as I can check that their value. But few of them are not interpolated. Those I am concerned with are initialized with a global jenkins variable which is either initialized itself as a constant value or using another global variable.
      But some others initialized the same are correctly interpolated.
      So... I am a bit lost.
      Additionally, I tried with interpolate:false ... and surpringly the results was not worst ! It means that variables are interpolated... unless the few that are not.

       

       

        Attachments

          Activity

          Hide
          jlpinardon jlpinardon added a comment -

          It looks like interpolation is made only once, i.e. is not recursed until vars are all resolved.
          Let's consider :

          A global jenkins variable aGloblaVar initialized (on the global config) as 'rootDir'

          var1=${aGlobalVar}/folderPath

          var2=${var1}/anotherPath

          var1 is correctly initialized, but var2 value is '${globalVar}/folderPath' and not 'rootDir/folderPath'.

           

          Show
          jlpinardon jlpinardon added a comment - It looks like interpolation is made only once, i.e. is not recursed until vars are all resolved. Let's consider : A global jenkins variable aGloblaVar initialized (on the global config) as 'rootDir' var1=${aGlobalVar}/folderPath var2=${var1}/anotherPath var1 is correctly initialized, but var2 value is ' ${globalVar}/folderPath ' and not ' rootDir/folderPath '.  

            People

            Assignee:
            rsandell rsandell
            Reporter:
            jlpinardon jlpinardon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: