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

git-plugin notifyCommit should ignore case when comparing uri

    Details

    • Similar Issues:

      Description

      The Stash Webhook To Jenkins sends a "notifyCommit" message to the git-plugin that contains a URL with the stash project and repository specified in lower case. However, Stash will accept a clone url specified in any combination of upper and lower case allowing developers and project teams to create jenkins jobs that clone from Git using urls that are not all lower case. As a result, when notifyCommit messages come in, jobs that specified urls with any upper case letters will not have polling triggered, and the jobs do not run.

      We can fix these jobs as we discover them, but it is an administrative task that could be avoided if the git-plugin ignored case when comparing the uri from the notifyCommit message with the uri specified in the job.

      The attached patch changes the comparison to use StringUtils.equalsIgnoreCase().

      A more complete improvement should probably limit the use of equalsIgnoreCase to SSH and HTTP schemes. or to host names that have been configured as Stash servers.

      Also, when using Stash as the Git server, HTTP urls include 'scm' so the looselyMatches method will not detect that scm://host:7990/project/repo is the same repository as http://host:8080/scm/project/repo. Short of configuring git-plugin with a list of Stash servers, or perhaps using a new parameter on the notifyCommit to indicate that request is from Stash, I'm not sure the best way to address this.

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          I don't think this is the right approach. Git repository names are case sensitive on most platforms and on most hosting providers. Allowing case insensitive matching will open a whole host of bug reports about the number of places where the plugin performs case insensitive matching and where it does not. I think the plugin already struggles with excess complexity and really do not want to add the further complexity of testing many different situations that they are case insensitive.

          I recommend against this

          Show
          markewaite Mark Waite added a comment - I don't think this is the right approach. Git repository names are case sensitive on most platforms and on most hosting providers. Allowing case insensitive matching will open a whole host of bug reports about the number of places where the plugin performs case insensitive matching and where it does not. I think the plugin already struggles with excess complexity and really do not want to add the further complexity of testing many different situations that they are case insensitive. I recommend against this
          Hide
          mlgiroux Michael Giroux added a comment - - edited

          Perhaps a new parameter on the notifyCommit message to allow git-plugin to detect and support Stash.

          notifyCommit?stashServer=true&...

          or something similar. This allows git-plugin to preserve existing functionality, and add support for Stash without having to guess.

          Of course, this requires an update to the stash webhook to jenkins.

          Show
          mlgiroux Michael Giroux added a comment - - edited Perhaps a new parameter on the notifyCommit message to allow git-plugin to detect and support Stash. notifyCommit?stashServer=true&... or something similar. This allows git-plugin to preserve existing functionality, and add support for Stash without having to guess. Of course, this requires an update to the stash webhook to jenkins.

            People

            • Assignee:
              Unassigned
              Reporter:
              mlgiroux Michael Giroux
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: