简体   繁体   中英

Jenkins not triggered by github-webhook

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM