GitHub webhook troubleshooting

Issue

  • GitHub WebHook is not working as expected.
  • How to troubleshooting GitHub WebHook trigger issues.
  • Jobs are not triggered in Jenkins by a “push” and/or “pull request” events against a GitHub repository (“Repo X”).

Environment

  • Jenkins
  • Cloudbees Jenkins Enterprise (CJE)
  • GitHub plugin
  • GitHub Pull Request Builder plugin
  • CloudBees GitHub Pull Request Builder plugin
  • Pipeline Multibranch Plugin
  • GitHub Organization Folder Plugin
  • Github Webhook

Resolution

  1. Create a logger for GitHub in https://<JENKINS_URL>/log/ for org.jenkinsci.plugins.github so the received payload can be checked.
  2. Execute a GitHub events against the “Repo X” (Push, Pull Request).
  3. **Only for DEV@cloud** > Check the access logs in https://<JENKINS_URL>/container-logs/browse/ to see if the HTTP POST from GitHub was received.
  4. Check the logger created in Step 1.

GitHub logger configuration

github-hook-logger-configuration

Note: WebHook payloads are currently limited to 5MB. This limit applies to both GitHub.com as well as GitHub Enterprise. CloudBees Tomcat containers are limited to 2MB. CloudBees can increase the in the Tomcat container to 5MB but you need to request it through a support ticket.

Examples of expected outputs

Test Credentials

A similar output to this is expected:

Jul 01, 2016 12:51:38 PM FINE org.jenkinsci.plugins.github.webhook.GHEventHeader$PayloadHandler parse
Header X-GitHub-Event -> null
Jul 01, 2016 12:51:41 PM FINE org.jenkinsci.plugins.github.internal.GitHubLoginFunction applyNullSafe
Create new GH client with creds id 021643c7-ef89-4014-b835-6fab9add5165

Push Event

A similar output to this is expected:

Jul 01, 2016 12:32:03 PM FINE org.jenkinsci.plugins.github.webhook.GHEventHeader$PayloadHandler parse
Header X-GitHub-Event -> push
Jul 01, 2016 12:32:03 PM FINEST org.jenkinsci.plugins.github.webhook.GHEventPayload$PayloadHandler parse
Payload {"ref":"refs/heads/master","before":"a1a91ab98386e4eced8ce0720d5c44158e85a3db","after":"58831ba23954684d98c91fdd303b2c8cebc7c504","created":false,"deleted":false,"forced":false,"base_ref":null,"compare":"https://github.com/mock-carlosrodlop-org/game-of-life/compare/a1a91ab98386...58831ba23954","commits":

...

Jul 01, 2016 12:32:03 PM INFO org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
Received POST for https://github.com/mock-carlosrodlop-org/game-of-life
Jul 01, 2016 12:32:03 PM FINE org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
Considering to poke ZD-37633-CBGitHubPRBuilder
Jul 01, 2016 12:32:03 PM INFO org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
Poked ZD-37633-CBGitHubPRBuilder

Pull Request Event

A similar output to this is expected:

Jul 01, 2016 2:33:23 PM FINE org.jenkinsci.plugins.github.webhook.GHEventHeader$PayloadHandler parse
Header X-GitHub-Event -> pull_request
Jul 01, 2016 2:33:23 PM FINEST org.jenkinsci.plugins.github.webhook.GHEventPayload$PayloadHandler parse
Payload {"action":"closed","number":2,"pull_request":{"url":"https://api.github.com/repos/mock-carlosrodlop-org/game-of-life/pulls/2","id":75972749,"html_url":"https://github.com/mock-carlosrodlop-org/game-of-life/pull/2","diff_url":"https://github.com/mock-carlosrodlop-org/game-of-life/pull/2.diff","patch_url":"https://github.com/mock-carlosrodlop-org/game-of-
...

References

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.