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

github-plugin does not work with "insteadOf" in git url

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • github-plugin

      Hello.

      I've properly configured the Github plugin in Jenkins to communicate with my Github Enterprise instance. In GHE I've installed the "Jenkins (github plugin)" service so that every push event sends a hook to the proper Jenkins URL. The hook is sent and is received by jenkins as I can see from the logs (I've replaced sensitive content):

      ```
      ...
      Received POST for https://github.example.com/foo/bar
      ...
      Mar 17, 2015 6:47:51 PM FINE com.cloudbees.jenkins.GitHubWebHook
      Considering to poke bar
      Mar 17, 2015 6:47:51 PM FINE com.cloudbees.jenkins.GitHubWebHook
      Skipped bar because it doesn't have a matching repository.
      ```

      It just that the plugin does not match the name, and I can see why this happens.
      In our Jenkins server, the .gitconfig contains this line:

      ```
      [url "deploy@<our-github-proxy>.com:"]
      insteadOf = deploy:
      ```

      This is a requirement since in our infrastructure we use a github proxy to implement ACLs (but that's irrelevant). So to clone a project Jenkins does a `git clone deploy:foo/bar.git`. Also in the github plugin settings I've configured it to be so.

      But the github url to the repo is this: https://github.example.com/foo/bar. So it's different from the setting in the github plugin, even though the 2 urls point to the same repo. I suspect that the plugin parses also the git url (not just the "foo/bar.git" part), therefore it can't correlate the repos, which actually is the same underlying repo (despite the url being different): https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/com/cloudbees/jenkins/GitHubRepositoryName.java#L26

      UPDATE: If I switch the "Repository URL" (in "Source Code Management" section) to point to https://github.example.com/foo/bar instead, then I can see in the logs that it "pokes bar", so it works that way, but this is not feasible in our setup, since jenkins clones and fetches via `git clone deploy:foo/bar` and not `git clone git@github.example.com/foo/bar`.

      I believe that the plugin should have an (advanced) setting for such cases.

      This are my current plugin settings (attached image).

            Unassigned Unassigned
            mandingueiro mandingueiro a
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: