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

Broken env variable replacing

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      If I use environment variables in "Other CMake Arguments" it will replace the variables in an incorrect order. It needs to replace long names before short names.

      Example:
      The following variables exists:
      MERCURIAL_REVISION = 0c775e18b569d4c5b505bd5fb73b854d700247d8
      MERCURIAL_REVISION_BRANCH = default
      MERCURIAL_REVISION_NUMBER = 5543
      MERCURIAL_REVISION_SHORT = 0c775e18

      If I use _BRANCH, _NUMBER or _SHORT it will replace half of the variable with the content of MERCURIAL_REVISION:

      "0c775e18b569d4c5b505bd5fb73b854d700247d8_NUMBER" instead of "5543"

        Attachments

          Activity

          Show
          misery A. Klitzing added a comment - https://github.com/jenkinsci/cmakebuilder-plugin/pull/2
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: André Klitzing
          Path:
          src/main/java/hudson/plugins/cmake/EnvVarReplacer.java
          src/test/java/hudson/plugins/cmake/EnvVarReplacerTest.java
          http://jenkins-ci.org/commit/cmakebuilder-plugin/2542acd21fed0ee724ba5f3cc13213cfcca7f55b
          Log:
          JENKINS-27203 Fix handling of environment variables

          Replace longer variables first to avoid replacing a
          partial long name with a short name.

          Example:

          • NODE = abc
          • NODE_ID = 123

          Result "abc_ID" instead of "123"

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: André Klitzing Path: src/main/java/hudson/plugins/cmake/EnvVarReplacer.java src/test/java/hudson/plugins/cmake/EnvVarReplacerTest.java http://jenkins-ci.org/commit/cmakebuilder-plugin/2542acd21fed0ee724ba5f3cc13213cfcca7f55b Log: JENKINS-27203 Fix handling of environment variables Replace longer variables first to avoid replacing a partial long name with a short name. Example: NODE = abc NODE_ID = 123 Result "abc_ID" instead of "123"
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: volkai
          Path:
          src/main/java/hudson/plugins/cmake/EnvVarReplacer.java
          src/test/java/hudson/plugins/cmake/EnvVarReplacerTest.java
          http://jenkins-ci.org/commit/cmakebuilder-plugin/d5b88c8354960a97e80e89d6213d992d1d3120e7
          Log:
          Merge pull request #2 from misery/master

          JENKINS-27203 Fix handling of environment variables

          Compare: https://github.com/jenkinsci/cmakebuilder-plugin/compare/5276576a5772...d5b88c835496

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: volkai Path: src/main/java/hudson/plugins/cmake/EnvVarReplacer.java src/test/java/hudson/plugins/cmake/EnvVarReplacerTest.java http://jenkins-ci.org/commit/cmakebuilder-plugin/d5b88c8354960a97e80e89d6213d992d1d3120e7 Log: Merge pull request #2 from misery/master JENKINS-27203 Fix handling of environment variables Compare: https://github.com/jenkinsci/cmakebuilder-plugin/compare/5276576a5772...d5b88c835496
          Hide
          15knots Martin Weber added a comment -

          hudson.Util.replaceMacro(String, Map<String, String>)
          does what you need

          Show
          15knots Martin Weber added a comment - hudson.Util.replaceMacro(String, Map<String, String>) does what you need
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: 15knots
          Path:
          src/test/java/hudson/plugins/cmake/EnvVarReplacerTest.java
          http://jenkins-ci.org/commit/cmakebuilder-plugin/fd0ab9acd957bfe4739c86744483598c3c73351f
          Log:
          separated test for JENKINS-27203.
          added test for std form ${VAR]

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: 15knots Path: src/test/java/hudson/plugins/cmake/EnvVarReplacerTest.java http://jenkins-ci.org/commit/cmakebuilder-plugin/fd0ab9acd957bfe4739c86744483598c3c73351f Log: separated test for JENKINS-27203 . added test for std form ${VAR]
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: 15knots
          Path:
          src/main/java/hudson/plugins/cmake/CmakeBuilder.java
          src/main/java/hudson/plugins/cmake/CmakeLauncher.java
          http://jenkins-ci.org/commit/cmakebuilder-plugin/e7759457e509c1c2b5c26dc2803381e1d7811d8a
          Log:
          JENKINS-27203 eliminated double variable expansion

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: 15knots Path: src/main/java/hudson/plugins/cmake/CmakeBuilder.java src/main/java/hudson/plugins/cmake/CmakeLauncher.java http://jenkins-ci.org/commit/cmakebuilder-plugin/e7759457e509c1c2b5c26dc2803381e1d7811d8a Log: JENKINS-27203 eliminated double variable expansion
          Hide
          15knots Martin Weber added a comment -

          fixed in r6d3bc30..12a795e

          Show
          15knots Martin Weber added a comment - fixed in r6d3bc30..12a795e

            People

            • Assignee:
              15knots Martin Weber
              Reporter:
              misery A. Klitzing
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: