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

Property Variables "Randomly" Not Working/Getting Unset

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: envinject-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2003 SP2
    • Similar Issues:

      Description

      Variables are randomly getting unset or not resolved depending upon the name and length of the variable name itself.
      This is broken in 0.15, but was working correctly in 0.14.

      To reproduce:
      1) Create a task and configure it
      2) Add a "Inject Environment Variables" build step
      3) Paste the following into the Properties Content section:
      -----------------------------------------------------------------
      A=value
      B=${A}

      ZIP=${B}
      TIP=${B}
      TZP=${B}
      AIP=${B}
      UIP=${B}_${UNSETVAR}
      VIP=${B}_${UNSETVAR}
      -----------------------------------------------------------------
      4) Run the build

      Result in the log:
      ----------------------------------------------------------------------
      [EnvInject] - Injecting as environment variables the properties content
      'A=value
      B=${A}

      ZIP=${B}
      TIP=${B}
      TZP=${B}
      AIP=${B}
      UIP=${B}_${UNSETVAR}
      VIP=${B}_${UNSETVAR}'

      [EnvInject] - Unset 'VIP' variable.
      [EnvInject] - Unset 'TIP' variable.
      [EnvInject] - Unset 'ZIP' variable.
      ----------------------------------------------------------------------

      Problems:
      1) ZIP and TIP get unset even though they are identical to TZP and AIP
      2) UIP does not get unset, even though it has ${UNSETVAR} in it which cannot be resolved

      Should consider changing unset feature to optional, as some variables need to have the $ symbol in them,
      which will make it appear as unresolved.

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Gregory Boissinot
          Path:
          src/main/java/org/jenkinsci/plugins/envinject/EnvInjectListener.java
          src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectActionSetter.java
          src/main/java/org/jenkinsci/plugins/envinject/service/PropertiesService.java
          src/main/java/org/jenkinsci/plugins/envinject/service/PropertiesVariablesRetriever.java
          src/main/java/org/jenkinsci/plugins/envinject/util/SortedProperties.java
          http://jenkins-ci.org/commit/envinject-plugin/0c98e3096c1d2f02a16f2ae00cffec5f344b0241
          Log:
          Fixed JENKINS-11066

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Gregory Boissinot Path: src/main/java/org/jenkinsci/plugins/envinject/EnvInjectListener.java src/main/java/org/jenkinsci/plugins/envinject/service/EnvInjectActionSetter.java src/main/java/org/jenkinsci/plugins/envinject/service/PropertiesService.java src/main/java/org/jenkinsci/plugins/envinject/service/PropertiesVariablesRetriever.java src/main/java/org/jenkinsci/plugins/envinject/util/SortedProperties.java http://jenkins-ci.org/commit/envinject-plugin/0c98e3096c1d2f02a16f2ae00cffec5f344b0241 Log: Fixed JENKINS-11066
          Hide
          gbois Gregory Boissinot added a comment -

          Fixed in 0.17

          Show
          gbois Gregory Boissinot added a comment - Fixed in 0.17
          Hide
          gbois Gregory Boissinot added a comment -

          The defined order of the properties wins.
          $ character are not allowed as value for environment variables

          Show
          gbois Gregory Boissinot added a comment - The defined order of the properties wins. $ character are not allowed as value for environment variables
          Hide
          f_zschocke Florian Zschocke added a comment -

          This is still present in version 0.24. Some variables are reported as unresolved and get unset.

          File used (ci-env.prop):

          BASE_DIR=W:\data
          JAVA_BASE=${BASE_DIR}\sourcecode\external\java
          MPS_TOP=${BASE_DIR}\sourcecode\domain
          PROJECT_HOME=${WORKSPACE}
          
          JAVA_HOME=${JAVA_BASE}\ibm-java2-i386-6.0.8.1
          
          
          PROJECT_TOP=${PROJECT_HOME}
          PROJECT_SRC=${PROJECT_TOP}
          PROJECT_BUILD=${PROJECT_TOP}\build
          PROJECT_RES=${PROJECT_TOP}\delivery
          
          CBE_HOME=${MPS_TOP}\cbe
          M2_HOME=${CBE_HOME}\tools\maven\2.1.0
          ANT_HOME=${CBE_HOME}\tools\ant\1.6.5
          
          
          CYGWIN_HOME=C:\cygwin
          
          PATH=${M2_HOME}\bin;${JAVA_HOME}\bin;${ANT_HOME}\bin;${CYGWIN_HOME}\bin;${CYGWIN_HOME}\lib\rpm;${PATH}
          

          Output:

          [EnvInject] - Injecting as environment variables the properties file path 'ci-env.prop'
          [EnvInject] - Unset unresolved 'PROJECT_SRC' variable.
          [EnvInject] - Unset unresolved 'JAVA_HOME' variable.
          [EnvInject] - Unset unresolved 'PROJECT_BUILD' variable.
          [EnvInject] - Unset unresolved 'PATH' variable.
          [EnvInject] - Unset unresolved 'PROMPT' variable.
          

          The other (not reported) variables are set correctly in the environment.

          Show
          f_zschocke Florian Zschocke added a comment - This is still present in version 0.24. Some variables are reported as unresolved and get unset. File used (ci-env.prop): BASE_DIR=W:\data JAVA_BASE=${BASE_DIR}\sourcecode\external\java MPS_TOP=${BASE_DIR}\sourcecode\domain PROJECT_HOME=${WORKSPACE} JAVA_HOME=${JAVA_BASE}\ibm-java2-i386-6.0.8.1 PROJECT_TOP=${PROJECT_HOME} PROJECT_SRC=${PROJECT_TOP} PROJECT_BUILD=${PROJECT_TOP}\build PROJECT_RES=${PROJECT_TOP}\delivery CBE_HOME=${MPS_TOP}\cbe M2_HOME=${CBE_HOME}\tools\maven\2.1.0 ANT_HOME=${CBE_HOME}\tools\ant\1.6.5 CYGWIN_HOME=C:\cygwin PATH=${M2_HOME}\bin;${JAVA_HOME}\bin;${ANT_HOME}\bin;${CYGWIN_HOME}\bin;${CYGWIN_HOME}\lib\rpm;${PATH} Output: [EnvInject] - Injecting as environment variables the properties file path 'ci-env.prop' [EnvInject] - Unset unresolved 'PROJECT_SRC' variable. [EnvInject] - Unset unresolved 'JAVA_HOME' variable. [EnvInject] - Unset unresolved 'PROJECT_BUILD' variable. [EnvInject] - Unset unresolved 'PATH' variable. [EnvInject] - Unset unresolved 'PROMPT' variable. The other (not reported) variables are set correctly in the environment.

            People

            • Assignee:
              gbois Gregory Boissinot
              Reporter:
              pixman20 pixman20
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: