Webhook for Jenkins and github

One of the functions to link GitHub and Jenkins is called “Webhook”. By using this Webhook, you can run Jenkins’ jobs when pushing a branch to the repository managed on GitHub, when creating a new Pull Request, and so on.

There are three main ways to link Jenkins with GitHub and Webhook by the following three methods.

Jenkins Standard Webhook
– Set up “build for remote” provided as standard function of Jenkins
Git Plugin
– A plugin that can provide functions that can clone and execute git repositories when building Jenkins GitHub Plugin.
Plug-in to receive push event from GitHub
– Jenkins can automatically register Webhook to GitHub

Jenkins Standard Webhook
Build and trigger

Continue to configure Webhook with GitHub. From the repository page you can add it from Setting > Webhooks > Add Webhook.

Go to Github repository

See webhooks and add webhook

Jenkins
「Jenkinsの管理」>「ユーザーの管理」>「(API Token を取得したいユーザーID)」>「設定」>「APIトークンの表示」

Payload URL
http://[USER_ID]:[API_TOKEN]@[JENKINS_HOST]/job/[JOB_NAME]/[build|buildWithParameters]?token=[TOKEN_NAME]

Oh, Ok.
close jenkins
[vagrant@localhost app]$ sudo service jenkins stop
Shutting down Jenkins [ OK ]