11

I've created Jenkins Pipline job and want it to be triggered on my GitHub repo push event.

I've added repo url to job config and checked "trigger on push option": enter image description here

I've also added GitHub token with needed rights to jenkins configure Github section: enter image description here

In Github repo I've enabled webhook for my Jenkins server: enter image description here

And after all steps still nothing is triggered after push to my GitHub repo.

Does anyone have any idea what's going on and why Jenkins doesn't trigger configured pipeline job?

  • Are you sure Jenkins machine IP is visible to github? Since your settings look ok – Olia May 03 '17 at 14:19
  • @Olia , Yeah, ofc, it's public amazone IP, If I setup webhook in my repo manually wo/ Github services support, then I can see that my server response 200 status code per each push action for request from GitHub. But nothing happens on Jenkins side. –  May 03 '17 at 16:11
  • 3
    I guess, you may take a look at this issue: https://issues.jenkins-ci.org/browse/JENKINS-35132 (Also note that the job has to be executed manually one time in order for the push trigger and the git repo to be registered) – Olia May 03 '17 at 16:15
  • 4
    Sry guys, already resolved the issue, such pipeline job must be run manually once after configuration. That's all. –  Aug 09 '17 at 05:28
  • 1
    In the above comment I suggested to do the same) – Olia Aug 09 '17 at 11:15

2 Answers2

13

Solution mentioned by OP in a comment is correct.

Assuming you have a Github webhook for your Jenkins set up correctly and accessible (can be verified in the Github UI), you need to start the build manually once. Upon completion of the build, changes in the repository will automatically start new builds.


A note from user8888:

You actually need to manually start the build and the build must be successful. A failed build won't do anything.

Dan Mašek
  • 17,852
  • 6
  • 57
  • 85
  • 1
    This was not obvious to me so to clarify for others - you actually need to manually start the build and the build must actually be **successful**. A failed build won't do anything. – ptk Dec 14 '19 at 10:00
-3

With Github hook trigger for GITScm polling, you need to enable "Poll SCM" option because github push triggers git polling to verify if there is a new change and then runs the build if a change is found. You can keep the cron schedule empty.Github webhook with scm poll

jjd2610
  • 3
  • 3
  • 3
    This is incorrect. As in the comments above, a manual run is necessary to make Jenkins pick up the webhook. – mafrosis May 20 '18 at 04:10
  • 3
    The correct option is to correctly configure the "GitHub hook trigger for GITScm polling" option. The "Poll SCM" option warns, "Note that this is going to be an expensive operation for CVS, as every polling requires Jenkins to scan the entire workspace and verify it with the server. Consider setting up a "push" trigger to avoid this overhead" – Jeff Diederiks Jul 18 '18 at 16:49