- Schedule your build
- Pull your code and data files from your GitHub repository to your Jenkins machine
- Automatically trigger each build on the Jenkins server, after each Commit on your Git repository
Step 1 – Install the Github Jenkins plugin
Go to “Manage Jenkins” –> “Manage Plugins” –> “Available” Tab –> Search for “GitHub plugin” and install it.
Step 2 – Configure the “GitHub plugin” with github accounts and taken
Go to “Manage Jenkins” –> “Configure System” –> Locate “Github” section and “Add Github Server” and do following modification.
- API URL – If you server is github.com, your “API URL” would be “https://api.github.com”. Otherwise if you use GitHub Enterprise, specify its API endpoint here (e.g., https://ghe.acme.com/api/v3/).
- Credentials – You can create your own personal access token in your account GitHub settings. Token should be registered with scopes. Refer https://github.com/settings/tokens/new . Add credentials (your Github token) and Apply.
- “Test Connection”.
Step 3 – Configure Jenkins Job on which you want push trigger should be effective.
- Check the GitHub project checkbox and set the Project URL to point to your GitHub Repository
- Under Source Code Management, check Git and set the Repository URL to point to your GitHub Repository
- Under Build Triggers, check the “GitHub hook trigger for GITScm polling” checkbox
Step 4 – Configure “webhook” on github for the specific repository.
Go to repostory settings and then “Webhooks” and Click on “Add Webhook” and then fill a “Payload URL” and leave secret empty. “Payload URL” must be your jenkins server url postfix with “/github-webhook/”. Such as http://220.127.116.11:8080/github-webhook/