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

Environment variable replacement/resolving

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Trivial
    • Resolution: Fixed
    • core
    • Jenkins ver. 1.500

    Description

      The function hudson.Util.replaceMacro(String, ...) does not resolve properties with '.'
      E.g. many java properties or build parameters do/can have a dot in their names which cannot be expanded by this method which seems to be used by some plugins.
      Please add the dot to hudson.Util.VARIABLE pattern.

      Thx

      Attachments

        Issue Links

          Activity

            zioschild Sven Appenrodt created issue -

            I've picked resolving this issue as an easy first contribution to Jenkins. First, I'd like to discuss backwards compatibility. Given these <key,value> mappings: <A,a>, <B,b> and <A.B,a-b>. How should $A.B and ${A.B} be evaluated? I think $A.B should evaluate to a.B, as it currently does, and ${A.B} to a-b instead of the current ${A.B}. With that scheme:

            1) References to keys with dots must use brackets.
            2) Existing ${A.B}-like references will break if there actually is an A.B key defined, which I think is very unlikely.

            Is this an acceptable resolution?

            lnorth Laurence North added a comment - I've picked resolving this issue as an easy first contribution to Jenkins. First, I'd like to discuss backwards compatibility. Given these <key,value> mappings: <A,a>, <B,b> and <A.B,a-b>. How should $A.B and ${A.B} be evaluated? I think $A.B should evaluate to a.B, as it currently does, and ${A.B} to a-b instead of the current ${A.B}. With that scheme: 1) References to keys with dots must use brackets. 2) Existing ${A.B}-like references will break if there actually is an A.B key defined, which I think is very unlikely. Is this an acceptable resolution?
            lnorth Laurence North made changes -
            Field Original Value New Value
            Assignee Laurence North [ lnorth ]

            It is
            Thx

            zioschild Sven Appenrodt added a comment - It is Thx

            Code changed in jenkins
            User: Larry North
            Path:
            core/src/main/java/hudson/Util.java
            core/src/test/java/hudson/UtilTest.java
            http://jenkins-ci.org/commit/jenkins/3376cf01580ecd9cd099b5513874c8bed2490839
            Log:
            [FIXED JENKINS-16660] Allow variable names with dots in bracketed references.

            Given these <variable,value> mappings: <A,a> and <A.B,a-b>, $A.B would
            evaluate to $a.B, as it currently does, and ${A.B} to a-b instead of the
            current ${A.B}.

            Existing ${A.B}-like references will break (not evaluate to ${A.B}) if
            there actually is an A.B variable defined, which I think is very
            unlikely.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Larry North Path: core/src/main/java/hudson/Util.java core/src/test/java/hudson/UtilTest.java http://jenkins-ci.org/commit/jenkins/3376cf01580ecd9cd099b5513874c8bed2490839 Log: [FIXED JENKINS-16660] Allow variable names with dots in bracketed references. Given these <variable,value> mappings: <A,a> and <A.B,a-b>, $A.B would evaluate to $a.B, as it currently does, and ${A.B} to a-b instead of the current ${A.B}. Existing ${A.B}-like references will break (not evaluate to ${A.B}) if there actually is an A.B variable defined, which I think is very unlikely.
            scm_issue_link SCM/JIRA link daemon made changes -
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Resolved [ 5 ]
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #2758

            Result = SUCCESS

            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #2758 Result = SUCCESS
            oleg_nenashev Oleg Nenashev made changes -
            Labels lts-candidate

            Code changed in jenkins
            User: Larry North
            Path:
            core/src/main/java/hudson/Util.java
            core/src/test/java/hudson/UtilTest.java
            http://jenkins-ci.org/commit/jenkins/f664639b79d2dea2abdf48816b01f8ccc525a73f
            Log:
            [FIXED JENKINS-16660] Allow variable names with dots in bracketed references.

            Given these <variable,value> mappings: <A,a> and <A.B,a-b>, $A.B would
            evaluate to $a.B, as it currently does, and ${A.B} to a-b instead of the
            current ${A.B}.

            Existing ${A.B}-like references will break (not evaluate to ${A.B}) if
            there actually is an A.B variable defined, which I think is very
            unlikely.

            (cherry picked from commit 3376cf01580ecd9cd099b5513874c8bed2490839)

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Larry North Path: core/src/main/java/hudson/Util.java core/src/test/java/hudson/UtilTest.java http://jenkins-ci.org/commit/jenkins/f664639b79d2dea2abdf48816b01f8ccc525a73f Log: [FIXED JENKINS-16660] Allow variable names with dots in bracketed references. Given these <variable,value> mappings: <A,a> and <A.B,a-b>, $A.B would evaluate to $a.B, as it currently does, and ${A.B} to a-b instead of the current ${A.B}. Existing ${A.B}-like references will break (not evaluate to ${A.B}) if there actually is an A.B variable defined, which I think is very unlikely. (cherry picked from commit 3376cf01580ecd9cd099b5513874c8bed2490839)
            olivergondza Oliver Gond┼ża made changes -
            Labels lts-candidate 1.509.4-fixed
            ikedam ikedam made changes -
            Link This issue is related to JENKINS-22222 [ JENKINS-22222 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 147484 ] JNJira + In-Review [ 192437 ]

            People

              lnorth Laurence North
              zioschild Sven Appenrodt
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: