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

Jenkins unable to manage webhooks of Github organization

      Under GitHub Pull Request Builder configuration Auto-manage webhooks is enabled.

      In the GitHub Pull Request Builder added user credentials. User belongs to owners' User's credential tested and are working.

      Webhooks management however does not work. For every private repository there's an error message displayed in Jenkins: 

      There is no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=ORG_NAME,repository=REPO_NAME]

      From the error message it looks like plugin is trying to use organisation name as a user name, so authentication fails.

          [JENKINS-49332] Jenkins unable to manage webhooks of Github organization

          Dmytro Kovalov created issue -

          I am also getting the same error.  The webhook is trying to be built using the ORG name.  I am running against an GitHub Enterprise instance.  

          David Rodriguez added a comment - I am also getting the same error.  The webhook is trying to be built using the ORG name.  I am running against an GitHub Enterprise instance.  

          Dan Albu added a comment -

          I can confirm this also. Also using GitHub Enterprise instance.

          Dan Albu added a comment - I can confirm this also. Also using GitHub Enterprise instance.

          Adam BH added a comment - - edited

          Same message after upgrading to Github plugin 1.29.
          Also Enterprise Github instance.
          Manage web hooks in Github pull request builder: Disabled
          Manage hooks under github server: Disabled
          Error messages persist after disabling both manage web hook check boxes.

          Work around: I downgraded back to the last version I used, 1.28.1, which got rid of the message spam. Jenkins+Github worked even when I got the error messages, except things seemed a bit slower.

          Here is a full stack trace from the error I got on 1.29, server, org, and repo names removed:

          org.jenkinsci.plugins.github.webhook.WebhookManager$2 applyNullSafe
          WARNING: Failed to add GitHub webhook for GitHubRepositoryName[host=github.XXX.com,username=orgName,repository=repoName]
          java.lang.NullPointerException: There is no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.XXX.com,username=orgName,repository=repoName]
                  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)
                  at com.google.common.collect.Iterators$8.next(Iterators.java:812)
                  at com.google.common.collect.Iterators$7.computeNext(Iterators.java:648)
                  at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
                  at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
                  at com.google.common.collect.Iterators$7.computeNext(Iterators.java:647)
                  at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
                  at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138)
                  at com.google.common.collect.Lists.newArrayList(Lists.java:138)
                  at com.google.common.collect.Lists.newArrayList(Lists.java:119)
                  at org.jenkinsci.plugins.github.util.FluentIterableWrapper.toList(FluentIterableWrapper.java:147)
                  at org.jenkinsci.plugins.github.webhook.WebhookManager$1.run(WebhookManager.java:127)
                  at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119)
                  at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
                  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
                  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
                  at java.lang.Thread.run(Thread.java:748)
          

          The error messages appeared every time my github organizations were scanning, every 2 minutes. Again, I did not have manage hooks enabled for my github server or pull request builder configurations.

          I generated a brand new github token for jenkins, which I made sure had the right permissions, but the errors persisted after saving it (and then restarting jenkins for good measure).  The funny thing was Github reported the token was 'never used' after the errors were being thrown - it only said the token was used once I went back to Jenkins configuration and hit the 'test connection' to github button. Related possibly considering the 'null' parts of the stacktrace.

          Adam BH added a comment - - edited Same message after upgrading to Github plugin 1.29. Also Enterprise Github instance. Manage web hooks in Github pull request builder: Disabled Manage hooks under github server: Disabled Error messages persist after disabling both manage web hook check boxes. Work around: I downgraded back to the last version I used, 1.28.1, which got rid of the message spam. Jenkins+Github worked even when I got the error messages, except things seemed a bit slower. Here is a full stack trace from the error I got on 1.29, server, org, and repo names removed: org.jenkinsci.plugins.github.webhook.WebhookManager$2 applyNullSafe WARNING: Failed to add GitHub webhook for GitHubRepositoryName[host=github.XXX.com,username=orgName,repository=repoName] java.lang.NullPointerException: There is no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.XXX.com,username=orgName,repository=repoName] 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) at com.google.common.collect.Iterators$8.next(Iterators.java:812) at com.google.common.collect.Iterators$7.computeNext(Iterators.java:648) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at com.google.common.collect.Iterators$7.computeNext(Iterators.java:647) at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) at com.google.common.collect.Lists.newArrayList(Lists.java:138) at com.google.common.collect.Lists.newArrayList(Lists.java:119) at org.jenkinsci.plugins.github.util.FluentIterableWrapper.toList(FluentIterableWrapper.java:147) at org.jenkinsci.plugins.github.webhook.WebhookManager$1.run(WebhookManager.java:127) at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:119) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748) The error messages appeared every time my github organizations were scanning, every 2 minutes. Again, I did not have manage hooks enabled for my github server or pull request builder configurations. I generated a brand new github token for jenkins, which I made sure had the right permissions, but the errors persisted after saving it (and then restarting jenkins for good measure).  The funny thing was Github reported the token was 'never used' after the errors were being thrown - it only said the token was used once I went back to Jenkins configuration and hit the 'test connection' to github button. Related possibly considering the 'null' parts of the stacktrace.

          Frank Grimes added a comment -

          We're having the same problem trying to use the GitHub Branch Source Plugin.

          It seems to be ignoring the username in the configured username/password credentials and defaulting to the organization (Owner) value.

          This is completely blocking us from making use of the plugin since no WebHook registration can occur so our builds can't be triggered by PRs/etc.

          Any idea when this might be fixed? Also, is the priority of this really 'minor'?

          Frank Grimes added a comment - We're having the same problem trying to use the GitHub Branch Source Plugin. It seems to be ignoring the username in the configured username/password credentials and defaulting to the organization (Owner) value. This is completely blocking us from making use of the plugin since no WebHook registration can occur so our builds can't be triggered by PRs/etc. Any idea when this might be fixed? Also, is the priority of this really 'minor'?

          It is good to know that others are having this issue. I couldn't figure out how I broke this. Can this issue be changed to critical? This bug has really thrown a wrench in our pipeline.

          Jeff Gustafson added a comment - It is good to know that others are having this issue. I couldn't figure out how I broke this. Can this issue be changed to critical? This bug has really thrown a wrench in our pipeline.
          Jeff Gustafson made changes -
          Priority Original: Minor [ 4 ] New: Blocker [ 1 ]
          Jeff Gustafson made changes -
          Priority Original: Blocker [ 1 ] New: Critical [ 2 ]

          Also encountering this same error.

          Is there a workaround that can be used while this issue is being worked on, or a previous version of a plugin that doesn't exhibit this behavior?

          Samuel Loretan added a comment - Also encountering this same error. Is there a workaround that can be used while this issue is being worked on, or a previous version of a plugin that doesn't exhibit this behavior?

          Robby Pocase added a comment - - edited

          As far as I can tell, the plugin doesn't support webhook management for servers under the GitHub Enterprise Servers header. We're still seeing a lot of this in our logs, though.

          Robby Pocase added a comment - - edited As far as I can tell, the plugin doesn't support webhook management for servers under the GitHub Enterprise Servers header. We're still seeing a lot of this in our logs, though.

            lanwen Kirill Merkushev
            dmytro_kovalov Dmytro Kovalov
            Votes:
            27 Vote for this issue
            Watchers:
            46 Start watching this issue

              Created:
              Updated: