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

Environment variable replacement/resolving

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Trivial
    • Resolution: Fixed
    • Component/s: core
    • Labels:
    • Environment:
      Jenkins ver. 1.500
    • Similar Issues:

      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

            Hide
            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?

            Show
            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?
            Hide
            zioschild Sven Appenrodt added a comment -

            It is
            Thx

            Show
            zioschild Sven Appenrodt added a comment - It is Thx
            Hide
            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.

            Show
            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.
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #2758

            Result = SUCCESS

            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #2758 Result = SUCCESS
            Hide
            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)

            Show
            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)

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: