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

Webhook registration fails for private Github repositories

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • github-plugin
    • CentOS 7
      Jenkins 2.35
      GitHub API Plugin 1.80
      GitHub Authentication plugin 0.25
      GitHub Branch Source Plugin 1.5
      GitHub plugin 1.24.0

      Registering webhooks for private repositories fails, however it is successful for public repositories using the same access token for my account. I am able to clone the repository in the job, so I believe that my user access is properly configured, and all of the repositories are under my account, so I should have admin access. The access token does contain admin:repo_hook, and seems to be configured correctly based on the registration succeeding for the public repositories.

      I enabled logging based on the recommendation of the Github plugin and see the following:

      Dec 10, 2016 10:31:51 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
      Calling registerHooks() for PUBLIC_PROJECT
      
      Dec 10, 2016 10:31:51 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
      Calling registerHooks() for PRIVATE_PROJECT
      
      Dec 10, 2016 10:31:51 PM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
      GitHub webhooks activated for job email-templates-mock with [GitHubRepositoryName[host=github.com,username=doublesharp,repository=PUBLIC_PROJECT]] (events: [PUSH, REPOSITORY])
      
      Dec 10, 2016 10:31:51 PM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
      GitHub webhooks activated for job PRIVATE_PROJECT with [GitHubRepositoryName[host=github.com,username=doublesharp,repository=PRIVATE_PROJECT]] (events: [PUSH, REPOSITORY])
      
      Dec 10, 2016 10:31:51 PM WARNING org.jenkinsci.plugins.github.webhook.WebhookManager$2 applyNullSafe
      Failed to add GitHub webhook for GitHubRepositoryName[host=github.com,username=doublesharp,repository=PRIVATE_PROJECT]
      java.lang.NullPointerException: There is no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=doublesharp,repository=PRIVATE_PROJECT]
      	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:231)
      	at org.jenkinsci.plugins.github.webhook.WebhookManager$2.applyNullSafe(WebhookManager.java:156)
      	at org.jenkinsci.plugins.github.webhook.WebhookManager$2.applyNullSafe(WebhookManager.java:152)
      	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:137)
      	at org.jenkinsci.plugins.github.webhook.WebhookManager$1.run(WebhookManager.java:104)
      	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:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      
      

            integer Kanstantsin Shautsou
            doublesharp Justin Silver
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: