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

Environment variable on WINDOWS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows
    • Similar Issues:

      Description

      The "replaceMacro" method in core/src/main/java/hudson/Util.java doesn't work for Windows vairables.

      I installed the TestSwarm plugin from https://github.com/appendto/jenkins-testswarm. However, the environment vairables that I set in the plugin are not replace correctly. For example, I tried to use %GIT_COMMIT%, or ${GIT_COMMIT}. Either works. The Jenkin-Testswarm plugin correctly called the Util.replaceMacro method in Jenkins to the proper field, but the environment variables are not replaced.

      It seems the regex in the Util is not Windows friendly. If I change the code to the following, it works fine.

      Line 140: private static final Pattern VARIABLE = Pattern.compile("\\$%([A-Za-z0-9_]+|

      {[A-Za-z0-9_]+\\}

      )\\$%)");
      ...
      Line 169: String key = m.group(1);

      I have a folk and the changes to it. I'm not an expert on the other platform, can someone check if this works for both Windows and other platforms?
      https://github.com/xusun/jenkins/commit/b8dee2c710637e718290f93c31d3854099d2d157#comments

      Thanks,
      Xun

        Attachments

          Issue Links

            Activity

            xusun Xun Sun created issue -
            sogabe sogabe made changes -
            Field Original Value New Value
            Link This issue duplicates JENKINS-11446 [ JENKINS-11446 ]
            sogabe sogabe made changes -
            Resolution Duplicate [ 3 ]
            Status Open [ 1 ] Resolved [ 5 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 141676 ] JNJira + In-Review [ 189748 ]

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              xusun Xun Sun
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: