Day 24 Task – 90daysofdevops : Complete Jenkins CI/CD Project

What is GitHub Webhook
GitHub Webhooks are a feature of the GitHub platform that allow developers to receive notifications about events that occur in a GitHub repository.

Webhooks are HTTP callbacks that are triggered by specific events in a repository, such as a new commit, pull request, or issue being created or updated.

They provide a way to integrate external systems or services with GitHub and automate workflows based on repository activity.

When an event occurs, GitHub sends a POST request to a specified URL (endpoint) configured by the developer, containing information about the event.

Developers can secure their webhooks by using a secret token to verify the authenticity of incoming requests, ensuring that only valid requests are processed.

Advantages of GitHub WebHook

Using a webhook can provide many benefits to a programmer according to Indeed. Some of the benefits are:

Increase work efficiency:- Webhooks are a simple and effective way to send information from one application to another without complex procedures or the risk of missing important data. Unlike other APIs that regularly check for data, webhooks can immediately push data from events into other applications as soon as it’s available.

Easier automation:- Webhooks allow for easier automation of data transfer processes and user-defined actions for triggering events in software programs and applications. With webhooks, data can be instantly transferred, making it useful for creating repeated events based on the same triggering event.

Accurate data transfer:- Webhooks in programming provide specificity by allowing direct connections between specific parts of an application, without needing to connect multiple code elements to transfer data. This makes setting up a webhook faster and easier compared to using other APIs or callbacks. It also helps in keeping the code clean and understandable by reducing the amount of complicated code in the program.

Easy setup:-Using webhooks to connect applications often requires less setup time and effort compared to other methods. This is because webhooks use HTTP, which is a widely used internet protocol for transferring documents between web browsers and servers. Since most websites already use HTTP, adding a webhook to an application can be done easily without creating new infrastructure in your code.

Seamless integration:- If you’re making a new app and want to link it with other apps using webhooks, it’s usually easy because many apps support webhook integration. This is useful if you want to make an app that sends notifications, messages, or events based on existing app activity. You can even make services that let users link and integrate the apps they want and make personalized events and actions for their work or productivity.

How to create Webhooks?
To create a GitHub webhook:

1.Go to the settings page for your repository.

2.Click on the “Webhooks & Services” tab.

3.Then, click on the “Add webhook” button.

4.In the webhook configuration, you will need to provide the following information:

Payload URL: This is the URL that will receive the webhook notifications.

Events: Select the events that you want to be notified about.

Secret: This is a secret key that will be used to verify the authenticity of the webhook notifications.

5.Once you have configured the webhook, click on the “Create webhook” button.
Task-01
Fork this repository: To Fork Repository Go To location of Project then there is FORK option on top right side. Click on it you will able to fork Project.

Image description

Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration : Connection to your Jenkins Job with GitHub projects You can done through GitHub Hook : Go to project settings -> click on webhook -> Add webhook

Image description

Now for Installing GitHub Integration plugin in Jenkins
Open your jenkins dashboard.
Click on the Manage Jenkins button on your Jenkins dashboard
Click on Manage Plugins
Install GitHub Integration plugin

Image description

Image description

Image description

Image description

Read About GitHub WebHooks and make sure you have CICD setup

Task-02

In the Execute shell run the application using Docker compose

Image description

You will have to make a Docker Compose file for this Project

NOTE : Install the docker compose on your server ( like for ubuntu – docker-compose install -y)

After build you can check console output.

Image description

Image description

You will have to make a Docker Compose file for this Project (Can be a good open source contribution)

Image description


Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment

Your email address will not be published. Required fields are marked *

Discover more from Coursity

Subscribe now to keep reading and get access to the full archive.

Continue reading

Scroll to Top