Dave Schweisguth
Dave Schweisguth

Reputation: 37647

Why won't Jenkins build my project when I push to Github?

Jenkins 2.32.1, all plugins updated to latest versions today. I had this problem with somewhat older versions of plugins so I don't think it's just a recent plugin bug.

My project builds fine when I ask it to in the Jenkins UI. It also builds fine when I configure it to poll. However, I can't get it to build triggered by pushing to Github.

In my project's configuration,

enter image description here

On the Github side, I have

enter image description here

Webhook deliveries are successful, i.e. return HTTP status 200.

On https://jenkins.myorg.com/job/api/GitHubPollLog/ I see

Last GitHub Push
Started on Jan 11, 2017 10:33:41 PM
Using strategy: Default
[poll] Last Built Revision: Revision ee4b3fe5b57ecd5ae5875bce573b32bb60074dfa (refs/remotes/origin/master)
using GIT_SSH to set credentials 
 > git ls-remote -h [email protected]:myorg/myrepo.git # timeout=10
Found 2 remote heads on [email protected]:myorg/myrepo.git
Using strategy: Default
[poll] Last Built Revision: Revision ee4b3fe5b57ecd5ae5875bce573b32bb60074dfa (refs/remotes/origin/master)
using GIT_SSH to set credentials 
 > git ls-remote -h [email protected]:myorg/myrepo.git # timeout=10
Found 2 remote heads on [email protected]:myorg/myrepo.git
Done. Took 2 sec
No changes

The "last built revision" lines do indeed say the SHA of the revision that was most recently built (manually). But there are changes, because I just pushed a bogus update for testing purposes.

In Jenkins' main log I see

Jan 11, 2017 10:33:41 PM INFO
org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
Received POST for https://github.com/myorg/myrepo
Jan 11, 2017 10:33:41 PM INFO
org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber$1 run
Poked api

and nothing more.

I know similar questions have been asked many times. I've checked all of the considerations mentioned in

without success and read many others without getting any other insight. Any suggestions?

Upvotes: 4

Views: 1896

Answers (3)

zdravko zdravkin
zdravko zdravkin

Reputation: 2386

Are you using public IP for your Jenkins server?

I run on the same problem, and I am using socketxp for making a tunnel for the hooks to be public but still does not work, so I switch to Poll SCM

enter image description here

Upvotes: 0

Dave Schweisguth
Dave Schweisguth

Reputation: 37647

We eventually bypassed this problem by switching to the Jenkins functionality that scans one's Github organization and automatically creates a job for each repo with a Jenkins file. Repos thus created did build automatically when pushed to.

Upvotes: 0

jAvA
jAvA

Reputation: 593

We are using Jenkins ver 1.570-CIaaS, This have the below option which make the build trigger for every PR ( PR from any user ).

Build Triggers This have an option GitHub Pull Request Builder .

Not sure whether i answer to your question , just in case if this information helps.

Upvotes: -1

Related Questions