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

A dash character in an environment variable causes variable to not expand

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • git-plugin
    • None
    • Windows, git executeable, jenkins 1.643, git-plugin 2.4.1

      We try to use the "Branches to build" setting of the GIT plugin with variable substitution.

      That it should be possible and work is stated in the inline help for this parameter:

      ${ENV_VARIABLE}
      It is also possible to use environment variables. In this case the variables are evaluated and the result is used as described above.
      E.g. ${TREEISH}, refs/tags/${TAGNAME},...
      

      We have setup our job with the flag "Prepare environment to run" and added following parameter as "Properties Content":

      GIT-RELEASE_BRANCH=refs/heads/release/20160113
      

      In the field of "Branches to build" we tried to use

      ${GIT-RELEASE_BRANCH}
      

      We have also tried

      ${ENV_GIT-RELEASE_BRANCH}
      

      We can see for a specific build that the parameter is available as "Environment Variable".

      The job log looks like this (where the parameter is not replaces by the content):

       > D:\git\cmd\git.exe rev-parse "origin/${GIT-RELEASE_BRANCH}^{commit}" # timeout=10
       > D:\git\cmd\git.exe rev-parse "${GIT-RELEASE_BRANCH}^{commit}" # timeout=10
      

      We expect, that the variable is replaced by its content and used in the git command invocation.

            Unassigned Unassigned
            waffel Thomas Wabner
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: