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

Failed to add GitHub webhook for GitHubRepositoryName

    XMLWordPrintable

Details

    Description

      I've got a weird issue on my Jenkins server. We have a GitHub Organization job in Jenkins which corresponds to a GitHub organization with a variety of public/private repos. When I rescan the organization, I see a slew of errors like this in the Jenkins log, for both the public/private repos:

      Failed to add GitHub webhook for GitHubRepositoryName[host=github.com,username=<my github org>,repository=<some repo>] java.lang.NullPointerException: There is no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=<my github org>,repository=ci-control] at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:231) at org.jenkinsci.plugins.github.webhook.WebhookManager$2.applyNullSafe(WebhookManager.java:179) at org.jenkinsci.plugins.github.webhook.WebhookManager$2.applyNullSafe(WebhookManager.java:175) at org.jenkinsci.plugins.github.util.misc.NullSafeFunction.apply(NullSafeFunction.java:18)
      etc...

      I have double-checked the access token settings, and the token has all scopes for "repo" (as the documentation says). I have also tried granting permission to the "admin:repo_hook" and "admin:org_hook" scopes, but it didn't make any difference.

      The credential for the API token is a username/password, and although the username was blank I tried entering the actual username for the token owner. This also didn't make a difference, and weirdly, in the exception stacktrace in the logfile, it says username=<my github org> rather than username=<my github user> as I would have expected.

      Finally, I should note – the actual organization scan succeeds. We can build projects, and when we create new branches or pull requests, they get built as expected. It's only the organization scan that throws up a bunch of warnings.

      Am I doing something wrong, or is this a legit bug in the plugin? 

      Attachments

        Activity

          nre_ableton Nik Reiman created issue -

          For some reason the github plugin webhook manager checks wether the user has admin rights for the repository (https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java#L180).

          I used admin:repo_hook and admin:org_hook scopes, but only when i also gave the user admin permissions on the repository it works. But in this case the scopes arent't needed anymore. So either i did something else wrong or the webhook manager is not implemented correctly.

           

          sebastianreloaded Sebastian Opel added a comment - For some reason the github plugin webhook manager checks wether the user has admin rights for the repository ( https://github.com/jenkinsci/github-plugin/blob/master/src/main/java/org/jenkinsci/plugins/github/webhook/WebhookManager.java#L180). I used admin:repo_hook and admin:org_hook scopes, but only when i also gave the user admin permissions on the repository it works. But in this case the scopes arent't needed anymore. So either i did something else wrong or the webhook manager is not implemented correctly.  

          People

            Unassigned Unassigned
            nre_ableton Nik Reiman
            Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated: