Setting Up Jenkins GitHub Webhook Integration: 2 Easy Steps

on Automation, Continous Integration, DevOps, Github, Jenkins, JSON, Tutorials, Webhook • October 5th, 2021 • Write for Hevo

Continuous Integration (CI) is the DevOps (development and operations) practice for Software Development as it automates the testing, development, and deployment process in a fast-paced environment. Companies use DevOps to optimize their development and deployment processes. To implement Continous Integration in your project, you need to integrate your SCM (Source Control Management) tool with a CI tool.

Jenkins is an open-source CI tool used by many Developers to automate the testing and deployment of their applications. Jenkins GitHub Webhook allows Developers to save time and keep the project updated all the time. GitHub is one of the widely used SCM tools used for version control and allows Developers to collaborate with other Developers worldwide. 

Jenkins GitHub Webhook is used to trigger the action whenever Developers commit something into the repository. It can automatically compile or deploy applications if there are no errors detected. In this article, you will learn the steps to set up Jenkins GitHub Webhook. You will also read about the benefits of the Jenkins GitHub Webhook and how it helps Developers automate tasks.

Table of Contents

Prerequisites 

  • An active GitHub account.
  • Jenkins installed on the operating system.

Introduction to Jenkins

Jenkins Logo
Image Source

Jenkins is an open-source tool entirely built in Java that provides Continuous Integration (CI) for Software or Application Development. It automatically executes a series of actions or events that allows seamless ongoing development, testing, and deployment of newly created code. Whenever a developer commits changes to a code from a repository, Jenkins automatically triggers defined actions. 

Jenkins helps Developers continuously work on a project and improving it. Jenkins is one of the most used DevOps tools because it is open source and has strong community support. There are many plugins available in the market that makes Jenkins more powerful and adds capabilities to it.

Jenkins elements work together in the following manner, as shown below:

  • Developers make changes to the existing code available in the shared repository.
  • Jenkins server continuously checks for any change in the repository at regular intervals. Once any commit is made, Jenkins detects it.
  • The Build Server builds the code into an executable file. If the build fails, Developers receive feedback for a particular commit.
  • Jenkins deploys the application to the test server, and if it fails, the Developers get notified.
  • If every process goes error-free, then the application is deployed to the production server.

Key Features of Jenkins

Jenkins is a widely used tool for Continuous Integration in DevOps and helps Developers to make continuous changes to the application. A few features of Jenkins are listed below:

  • Easy Distribution: Jenkins is built using Java. It can distribute work across multiple machines to deliver faster testing, deployment, and build features to many platforms.
  • Easy Installation: Jenkins is independent of the platform because it is developed in Java. One can easily install it on Windows, Linux/ Unix, or macOS and configure it with its web interface.
  • Ready Plugins: Jenkins can extend its features and capabilities using plugins. There are many plugins available for Jenkins that help Developers ease the development process.

To learn more about Jenkins, click here.

Introduction to GitHub

GitHub Logo
Image Source

GitHub is a web-hosting service for version control and Software Development collaboration platforms. It offers several other functionalities such as bug tracking, feature requests, task management, Continuous Integration. Github allows Developers to collaborate with other Developers and work on shared project repositories. With the help of its version control feature, Developers can save different previous versions of the project source code that eliminates the process of making copies of each version control locally.

Key Features of GitHub

GitHub helps Developers maintain version control and optimizes the entire Software Development ecosystem. A few features of GitHub are listed below:

  • Profile Showcasing: GitHub allows Developers to upload their projects on a platform and set it public to let other people view developer’s profiles. Many companies use GitHub profiles to evaluate the skill set of any developer at the time of hiring.
  • Integrations: GitHub offers integration with many 3rd party tools and apps to let users sync data and optimize the workflow. It also integrates with code editors to manage the repository from the editor.
  • Project Management: GitHub allows companies to keep track of all the Software Development progress and collaborate with team members. 

To learn more about GitHub, click here.

Simplify Data Analysis with Hevo’s No-code Data Pipeline

Hevo Data, a No-code Data Pipeline helps to load data from any data source such as Salesforce, Databases, SaaS applications, Cloud Storage, SDK,s, and Streaming Services and simplifies the ETL process. It supports 100+ data sources (including 30+ free data sources like GitHub) and is a 3-step process by just selecting the data source, providing valid credentials, and choosing the destination. Hevo not only loads the data onto the desired Data Warehouse/destination but also enriches the data and transforms it into an analysis-ready form without having to write a single line of code.

Get Started with Hevo for Free

Its completely automated pipeline offers data to be delivered in real-time without any loss from source to destination. Its fault-tolerant and scalable architecture ensures that the data is handled in a secure, consistent manner with zero data loss and supports different forms of data. The solutions provided are consistent and work with different BI tools as well.

Check out why Hevo is the Best:

  1. Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  2. Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  3. Minimal Learning: Hevo, with its simple and interactive UI, is extremely simple for new customers to work on and perform operations.
  4. Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
  5. Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
  6. Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, E-Mail, and support calls.
  7. Live Monitoring: Hevo allows you to monitor the data flow and check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

Steps to Set Up Jenkins GitHub Webhook

Now that you have a good understanding of Jenkins and GitHub. In this section, you will learn about the steps to set up Jenkins GitHub Webhook. The following steps are listed below:

Step 1: Configuring Jenkins for GitHub

  • Log in to Jenkins.
  • Click on the “New Item” option to create a new job, as shown in the image below.
Jenkins GitHub Webhook - Adding New Job in Jenkins
Image Source: Self
  • Then, select the “Freestyle Project” option and click on the “Ok” button, as shown in the image below. 
Jenkins GitHub Webhook - New Job Name and Selecting Freestyle Project
Image Source: Self
  • It will open the configurations for the new Jenkins GitHub Webhook project you just created.
  • Go to the “Source Code Management” tab to change the settings for Jenkins GitHub Webhook.
  • Scroll down and under the “Source Code Management” section, choose the “Git” option to let Jenkins know that the new job is for Jenkins GitHub Webhook.
  • Log in to your GitHub account.
  • Open the repository that you want to sync with Jenkins for Continous Integration.
  • Go to your GitHub account and copy the URL of your repository from the address bar of the browser.
  • Switch back to your Jenkins GitHub Webhook tab and paste the URL in the field of “Repository URL“, as shown in the image below.
Jenkins GitHub Webhook - Entering GitHub Repository URL
Image Source: Self
  • Now, go to the “Build Triggers” tab where you can configure what action Jenkins GitHub Webhook should perform if any change is detected by Jenkins in the GitHub repository.
  • Here, choose the “GitHub hook trigger for GITScm pulling” option, which will listen for triggers from the given GitHub repository, as shown in the image below.
Jenkins GitHub Webhook - Choosing 
Build Triggers
Image Source: Self
  • Now, click on the “Apply” button to save the changes and create a new Jenkins GitHub Webhook for your repository.

Step 2: Setting Up GitHub Webhook

  • Switch to your GitHub account.
  • Now, go to the “Settings” option on the right corner, as shown in the image below.
Jenkins GitHub Webhook - Setting Button in GitHub
Image Source: Self
  • Here, select the “Webhooks” option and then click on the “Add Webhook” button, as shown in the image below.
Jenkins GitHub Webhook - Adding Bew Webhook in GitHub
Image Source: Self
  • It will provide you the blank fields to add the Payload URL where you will paste your Jenkins address, Content type, and other configuration.
  • Go to your Jenkins tab and copy the URL then paste it in the text field named “Payload URL“, as shown in the image below.
Jenkins GitHub Webhook - Webhook Configurations fields
Image Source: Self
  • Append the “/github-webhook/” at the end of the URL.
  • The final URL will look like in this format “http://address:port/github-webhook/“.
  • Select the “Content type” to “application/json” format, as shown in the image below.
Jenkins GitHub Webhook - choosing Content Type to application/json
Image Source: Self
  • The “Secret” field is optional. Let’s leave it blank for this Jenkins GitHub Webhook.
  • Next, choose one option under “Which events would you like to trigger this webhook?“. The 3 options will do the following events listed below:
    • Just the Push Event: It will only send data when someone push into the repository.
    • Send Me Everything: It will trigger, if there is any pull or push the event into the repository.
    • Let Me Select Individual Events: You can configure for what events you want your data.
  • Now, click on the “Add Webhook” button to save Jenkins GitHub Webhook configurations.

That’s it! You completed Jenkins GitHub Webhook. Now for any commit in the GitHub repository, Jenkins will trigger the event specified.

Benefits of Jenkins GitHub Webhook

Jenkins GitHub Webhook provides an environment for Continuous Integration (CI) and is widely used in the DevOps process. A few benefits of Jenkins GitHub Webhook are listed below:

  • Jenkins GitHub Webhook makes the development process faster as it allows Developers to automatically perform a specified action when any commit is done to the source code.
  • It helps Developers detect issues and resolve them almost right away which keeps the application in a state to deploy safely.
  • Jenkins GitHub Webhook automates the build, test, and deployment of projects on any platform.

Conclusion

In this article, you learnt the steps to set up Jenkins GitHub Webhook. You also read about the benefits of using Jenkins GitHub Webhook in Software Development and how it helps Developers save time. Jenkins helps Developers to trigger some actions or events, and GitHub allows them to maintain version control. Companies need Jenkins GitHub Webhook to optimize their Software Development.

Visit our Website to Explore Hevo

GitHub stores many version control of a project and essential information that is useful for companies when analyzed. Hevo Data is a No-code Data Pipeline that can help you transfer data from GitHub for free to desired Data Warehouse. It fully automates the process to load and transform data from 100+ sources to a destination of your choice without writing a single line of code. 

Want to take Hevo for a spin? Sign Up here for a 14-day free trial and experience the feature-rich Hevo suite first hand.

Share your experience of learning about Jenkins GitHub Webhook in the comments section below!

No-code Data Pipeline For your Data Warehouse