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

Git fetch fails when Repository URL is a Parameter with trailing whitespace

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • git-plugin
    • None
    • Jenkins 1.559
      git plugin 2.2.1
      git-client plugin 1.8.0
      multiple-scms plugin 0.3
      RHEL6 master with RHEL5 slave

      We have a job which passes the GIT_URL as a string parameter, supplied by the user. When the user does a Copy + Paste into the value field, sometimes a trailing whitespace is included. This appears to mess the plugin up somehow.

      We are also using multiSCM, but I doubt it's related to the underlying issue.

      If the Git URL is configured in the job config, the trailing whitespace is automatically trimmed when the job configuration is saved into config.xml. So this is only an issue if the GIT_URL is provided as a parameter to the job.

      When the Git URL is a parameter, the whitespace is not trimmed, and the job fails during git fetch with the following log output:

      Cloning repository git://my/git/URL.git
      Fetching upstream changes from git://my/git/URL.git
      FATAL: Failed to fetch from git://my/git/URL.git
      hudson.plugins.git.GitException: Failed to fetch from git://my/git/URL.git
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java.623)
      at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java.855)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:880)
      at org.jenkinsci.plugins.multiplescms.MultiSCM.checkout(MultiSCM.java:118)
      at ...
      Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress git://my/git/URL.git +refs/heads/:refs/remotes/origin/" returned status code 128:
      stdout:
      stderr: fatal: The remote end hung up unexpectedly

      at org.jenkinssci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1276)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1146)
      at ...

      Not a big deal, as long as we know to trim the whitespace manually.

            Unassigned Unassigned
            jthornsen Jeff Thornsen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: