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

readProperties does not interpolate some vars

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • Master and Slave run each on a centOS VM
      Jenkins 2.121.3
      Pipeline-Utility-Steps : 2.2.0

      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.

       

       

          [JENKINS-55701] readProperties does not interpolate some vars

          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'.

           

          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 '.  

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

              Created:
              Updated: