Jenkins is an open-source automation server that facilitate the continuous integration and continuous delivery. In the aim to automate the whole process from pushing a code to the GitHub repository until deployment, an interesting plugin could be added.
The GitHub Integration plugin enables the automatic run of the Jenkins pipeline each time the user pushes new changes to his GitHub repository.
1. Install the “GitHub Integration” Plugin
- Head to “Manage Plugins” under “Manager Jenkins”
- Look for “GitHub Integration” plugin and then click install.
2. Now head to your Jenkins project and click “Configure”
3. Under the “Build Triggers” section, check “GitHub hook trigger for GITScm polling” then click “Save”.
4. Now in your GitHub repository go to “Webhooks” section under “Settings” section and click “Add webhook”.
5. Configure your webhook by adding your payload URL (/github-webhook/) and your content type.
6. Click “Add webhook”
7. Now that it’s all configured in both sides let’s test it. We edited our index.jsp file and pushed the new code to our repository:
8. On our Jenkins project, we noticed that once we’ve pushed the code a pipeline started automatically :
9. Once the pipeline is completed, we’ll notice that the new code has been added to our deployed application.