4
votes

I have taken these steps:

  • Check "GitHub project" and set up the project
  • Check "GitHub hook trigger for GITScm polling"
  • Setup connection to private repository with user/password
  • If I build manually, it works
  • In GitHub, create a webhook on push to http://my_jenkins_url/github-webhook/
  • Whenever I commit something, it shows that a webhook has been sent and I get a 200 response code (on github)

But no build is triggered on Jenkins. The GitHub Hook Log says: "Polling has not run yet.". How can I make it "start"? How can I further debug this?

EDIT: I have not added a GitHub Server in Manage Jenkins -> Configure -> GitHub since I ran into issue with the authentication (but that would be a different question). Is this required for github webhooks?

EDIT2: I figured out how to add a GitHub API to the Jenkins config (using Personal Access Token with git hook access enabled). But it doesn't seem to make a difference.

1
I hope youre not running Jenkins as local host? Then it wont work. I know I'm not supposed to post links but here is a very easy blogpost on one of the easiset way to implement webhooks. For me it worked like a charm. dzone.com/articles/… - chrillelundmark
did you ever solve this? - dim_user

1 Answers

4
votes

I found how to fix it properly.

First. set Jenkins logger at Jenkins manage > system log

add log recoder, with this configuration

hudson.plugins.git.GitStatus - All
com.cloudbees.jenkins.GitHubWebHook - All
org.jenkinsci.plugins.github - All

Second. Hook trigger again.

and check logger again. In my case, the logger says

Skipped {ProjectName} because it doesn't have a matching repository.

Third. Check the webhook url where the webhook request exactly came from.

it will be specified at logger like this:

Received PushEvent for https://github.com/{username}/{reponame} from {ip} ⇒ http://{your jenkins url}/github-webhook/

Fourth. Again go to jenkins project configuration,

check whole github urls are exactly same as https://github.com/{username}/{reponame} at step 3.

No .git at last.

I hope this answer helps you. Thank you