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

EnvInject stopped resolving environment variables in environment variables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • envinject-plugin
    • None
    • Jenkins 1.463, EnvInject 1.54 or 1.50

      This looks like an exact regression to JENKINS-13183.

      We have a Promotion job that injects an env var whose value contains references to other env vars, read from a properties file:

        <buildSteps>
          <EnvInjectBuilder>
            <info>
              <propertiesFilePath>StageCraft.properties</propertiesFilePath>
              <propertiesContent>ReleaseDir=${ReleaseRoot}\${PROJECT_NAME}\${PROJECT_NAME}_${PROJECT_SHORT_VERSION}
      ReleaseDirTest=${env[&apos;PROJECT_SHORT_VERSION&apos;]}
      </propertiesContent>
            </info>
          </EnvInjectBuilder>
      

      (note we added a 'ReleaseDirTest' env var to also try the alternate env var reference syntax).

      EnvInject used to be fine with this, but after we did a few upgrades (to Jenkins itself and to the EnvInject plugin), it stopped working. Here's the output, together with a dump of the env vars injected in the build steps for diagnostics purposes:

      Promoting ANONYMIZED #6
      [EnvInject] - Injecting environment variables from a build step.
      [EnvInject] - Injecting as environment variables the properties file path 'StageCraft.properties'
      [EnvInject] - Variables injected successfully.
      [EnvInject] - Injecting as environment variables the properties content 
      ReleaseDir=${ReleaseRoot}\${PROJECT_NAME}\${PROJECT_NAME}_${PROJECT_SHORT_VERSION}
      ReleaseDirTest=${env['PROJECT_SHORT_VERSION']}
      
      [EnvInject] - Variables injected successfully.
      [EnvInject] - Unset unresolved 'ReleaseDir' variable.
      [EnvInject] - Unset unresolved 'ReleaseDirTest' variable.
      build org.jenkinsci.plugins.envinject.EnvInjectBuilder@53c01def SUCCESS
      [workspace] $ cmd /c call C:\Users\svc_ci\AppData\Local\Temp\hudson1186946183352599382.bat
      
      C:\jenkins\jobs\ANONYMIZED\workspace>SET
      ALLUSERSPROFILE=C:\ProgramData
      ...
      ProgramW6432=C:\Program Files
      PROJECT_FULL_VERSION=1.6.0.7
      PROJECT_NAME=ANONYMIZED
      PROJECT_SHORT_VERSION=1.6.0
      PROMOTED_ID=2012-06-01_15-42-27
      ...
      
      C:\jenkins\jobs\Cupid_1.6.x\workspace>exit 0 
      

        1. config.xml
          2 kB
        2. config.xml
          14 kB
        3. config.xml
          3 kB
        4. Plugins.csv
          1 kB
        5. test-job-1.xml
          0.9 kB

            gbois Gregory Boissinot
            gabrielegiuseppini Gabriele Giuseppini
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: