3
votes

So, this is what I've done so far:

  • Created GitHub personal access token with God's permissions (except delete repos)
  • Associated personal access token in Jenkins > Manage Jenkins > Configure System> GitHub , I test it and says "Credentials verified for user dim_user, rate limit: 4998" enter image description here
  • Checked "Manage hooks"
  • In Source Code Management I set it like this:
    • Repository URL: [email protected]:ORG_NAME/bootcamp_databases
    • Credentials: - none - (I'm using local's Git config file and id_rsa private key)
  • Also in "Build triggers" I've checked "GitHub hook trigger for GITScm polling" which refers to the old "Build when a change is pushed to GitHub" enter image description here
  • I am able to Manually build it and it works perfectly (gets source code from GitHub and deploys everything)
  • In the project's GitHub Hook Log it shows: "Polling has not run yet" enter image description here
  • GitHub recent Webhook deliveries are successful

enter image description here

Jenkins Logs (jenkins.err)

Jul 17, 2019 10:11:31 AM org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
INFO: Received PushEvent for https://github.com/ORG_NAME/bootcamp_databases from XXX.XX.115.71 ? http://XXXXXXXX.ngrok.io:8080/github-webhook/

Project item: Freestyle

Jenkins Version: 2.176.1

I've tried these and did not help:

Actual:

enter image description here

Expected:

To actually fetch the code when pushing to GitHub and triggering the jenkins build.

What am I missing, all of the above points were solutions on other stackoverflow questions but so far not good.

1
For webhook trigger the project has to have run at least once, i think jenkins then records the scm urls to watch for on the job. Did you run the job once after setup?Dominik Gebhart

1 Answers

-1
votes

I think your error is here:

  • Build triggers" I've checked "GitHub hook trigger for GITScm polling

In Jenkins an others c.i servers there are two techniques to detect scm source changes:

  • Polling: Jenkins asks periodically to github if source code has changes ( i.e git clone every minute and compare )
  • webhook: Github notify to your Jenkins when an event is detected in git platform( github, bitbucket etc). This is more cheap and does not need check changes at predefined interval (polling)

My advice is to try with webhooks instead scm polling. Also polling is an outdated technique.