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

when passing in ref_spec with build parameters, the exact string "$REF_SPEC" is used rather then the value

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      To replicate:

      1) create a job and pass in refspec as build parameter e.g. "$GIT_REFSPEC"

      2) use the parameter "$GIT_REFSPEC" as the SCM configuration for git-plugin

      3) The build will use the exact string "$GIT_REFSPEC" rather than the actual value of $GIT_REFSPEC for the fetch operation.

      For example:
      01:26:08 using GIT_SSH to set credentials Gerrit SSH Key
      01:26:08 > /usr/bin/git fetch --no-tags --progress ssh://[github-project-url] $GIT_REFSPEC --depth=2
      01:31:43 > /usr/bin/git config remote.origin.url ssh://[github-project-url] # timeout=10
      01:31:43 > /usr/bin/git config --add remote.origin.fetch $GIT_REFSPEC # timeout=10
       

      I believe the .toString in this line is causing this problem:

      https://github.com/jenkinsci/git-client-plugin/blob/4241e818dbe27fb78093094f29ebcd2203166610/src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java#L617

          [JENKINS-49758] when passing in ref_spec with build parameters, the exact string "$REF_SPEC" is used rather then the value

          sam leung created issue -
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-23477 [ JENKINS-23477 ]
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-30287 [ JENKINS-30287 ]
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-34603 [ JENKINS-34603 ]
          Mark Waite made changes -
          Link New: This issue is related to JENKINS-49834 [ JENKINS-49834 ]
          Mark Waite made changes -
          Link New: This issue is duplicated by JENKINS-49834 [ JENKINS-49834 ]
          Boguslaw Klimas made changes -
          Link New: This issue is blocking JENKINS-50131 [ JENKINS-50131 ]
          Martin Weber made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Martin Weber made changes -
          Attachment New: image-2019-09-26-16-32-02-026.png [ 48866 ]
          Martin Weber made changes -
          Attachment New: image-2019-09-26-16-34-33-817.png [ 48867 ]

            Unassigned Unassigned
            slcy sam leung
            Votes:
            10 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: