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

Github multibranch: GitHub Webhook is not created right after saving the job

    Details

    • Similar Issues:
    • Sprint:
      Pipeline - December

      Description

      I am observing the following behavior:

      1.- Fresh installation, installing latest version of Pipeline, GitHub plugin and GitHub Branch Source Plugin

      2.- Manage Jenkins > Configuring GitHub plugin: Credentials of an Owner of a Organization which hosts a Repo X

      3.- New Pipeline Multibranch Item pointing to Repo X, after saving the job the webhook in GitHub is not automatically generated (vs. GitHub Organization Folder item which is done)

      4.- Manage Jenkins > GitHub plugin > Advanced > Re-register hooks for all jobs > webhook in GitHub is finally generated
       
      What I am reporting: I'd expect the webhook in GitHub is automatically generated right after the saving the Pipeline Multibranch Branch but it does not it until I click on Re-register hooks for all jobs (GitHub plugin)

        Attachments

          Issue Links

            Activity

            Hide
            carlosrodlop Carlos Rodríguez López added a comment - - edited

            rsandell Stephen Connolly I am reopening this ticket again because the same reported issue seems to be back running (Regression?)

            Environment

            Jenkins LTS 2.164.2
             * github:1.29.4 'GitHub plugin'
             * github-api:1.95 'GitHub API Plugin'
             * github-branch-source:2.5.0 *(update available)* 'GitHub Branch Source Plugin'
            

            Observations

            What we see on Jenkins logs
            May 16, 2019 3:12:38 PM org.jenkinsci.plugins.github.webhook.WebhookManager$2 applyNullSafe
            WARNING: Failed to add GitHub webhook for GitHubRepositoryName[host=github.com,username=mock-carlosrodlop-org,repository=my-hw-maven-app]
            java.lang.NullPointerException: There are no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=mock-carlosrodlop-org,repository=my-hw-maven-app]
            

            But it is not right... I am using this repo https://github.com/mock-carlosrodlop-org/my-hw-maven-app with user:carlosrodlop and pass:APIToken and as you can tell from the following images carlosrodlop is an admin

            Custom dedicated loggers as explained in this guide: GitHub-Webhook-Troubleshooting are not providing any useful hint just
            May 16, 2019 4:05:50 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
            Calling registerHooks() for multibranch-example-job
            May 16, 2019 4:05:51 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
            Calling registerHooks() for multibranch-example-job
            
            Manage Jenkins > GitHub plugin > Advanced > Re-register hooks for all jobs > webhook in GitHub is NOT generated either. Independently if I enabled or disable Manage hooks options the output is the same: Works only when Jenkins manages hooks (one or more creds specified)
            Show
            carlosrodlop Carlos Rodríguez López added a comment - - edited rsandell Stephen Connolly I am reopening this ticket again because the same reported issue seems to be back running (Regression?) Environment Jenkins LTS 2.164.2 * github:1.29.4 'GitHub plugin' * github-api:1.95 'GitHub API Plugin' * github-branch-source:2.5.0 *(update available)* 'GitHub Branch Source Plugin' Observations What we see on Jenkins logs May 16, 2019 3:12:38 PM org.jenkinsci.plugins.github.webhook.WebhookManager$2 applyNullSafe WARNING: Failed to add GitHub webhook for GitHubRepositoryName[host=github.com,username=mock-carlosrodlop-org,repository=my-hw-maven-app] java.lang.NullPointerException: There are no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=mock-carlosrodlop-org,repository=my-hw-maven-app] But it is not right... I am using this repo https://github.com/mock-carlosrodlop-org/my-hw-maven-app with user:carlosrodlop and pass:APIToken and as you can tell from the following images carlosrodlop is an admin Custom dedicated loggers as explained in this guide: GitHub-Webhook-Troubleshooting are not providing any useful hint just May 16, 2019 4:05:50 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply Calling registerHooks() for multibranch-example-job May 16, 2019 4:05:51 PM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply Calling registerHooks() for multibranch-example-job Manage Jenkins > GitHub plugin > Advanced > Re-register hooks for all jobs > webhook in GitHub is NOT generated either. Independently if I enabled or disable Manage hooks options the output is the same: Works only when Jenkins manages hooks (one or more creds specified)
            Hide
            carlosrodlop Carlos Rodríguez López added a comment -

            It is working fine after deep testing

            Show
            carlosrodlop Carlos Rodríguez López added a comment - It is working fine after deep testing
            Hide
            dlakatos847 David Lakatos added a comment - - edited

            Carlos Rodríguez López I experienced the same issue you did. What do you mean "It is working fine after deep testing"? How did your problem disappear?

            While my OAuth token used by Jenkins has the admin:repo_hook permission on Github, Jenkins throws this exception for all of my managed repositories:

            Jul 06, 2019 10:34:16 AM WARNING org.jenkinsci.plugins.github.webhook.WebhookManager$2 applyNullSafe
            Failed to add GitHub webhook for GitHubRepositoryName[host=github.com,username=*****,repository=*****]
            java.lang.NullPointerException: There are no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=*****,repository=*****]
            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 jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
            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)

            Show
            dlakatos847 David Lakatos added a comment - - edited Carlos Rodríguez López I experienced the same issue you did. What do you mean "It is working fine after deep testing"? How did your problem disappear? While my OAuth token used by Jenkins has the admin:repo_hook permission on Github, Jenkins throws this exception for all of my managed repositories: Jul 06, 2019 10:34:16 AM WARNING org.jenkinsci.plugins.github.webhook.WebhookManager$2 applyNullSafe Failed to add GitHub webhook for GitHubRepositoryName [host=github.com,username=*****,repository=*****] java.lang.NullPointerException: There are no credentials with admin access to manage hooks on GitHubRepositoryName [host=github.com,username=*****,repository=*****] 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 jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59) 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)
            Hide
            dlakatos847 David Lakatos added a comment -

            FYI I fixed my issue by regenerating my OAuth access token. It may have been misconfigured in my Jenkins' credentials...

            Show
            dlakatos847 David Lakatos added a comment - FYI I fixed my issue by regenerating my OAuth access token. It may have been misconfigured in my Jenkins' credentials...
            Hide
            carlosrodlop Carlos Rodríguez López added a comment -

            Hi David Lakatos,

            I forgot to configure correctly the Git Plugin see https://support.cloudbees.com/hc/en-us/articles/224543927-GitHub-Integration-Webhooks

            Regards,

            Show
            carlosrodlop Carlos Rodríguez López added a comment - Hi David Lakatos , I forgot to configure correctly the Git Plugin see https://support.cloudbees.com/hc/en-us/articles/224543927-GitHub-Integration-Webhooks Regards,

              People

              • Assignee:
                rsandell rsandell
                Reporter:
                carlosrodlop Carlos Rodríguez López
              • Votes:
                1 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: