# Day24 of 90daysofdevopschallenge

**Webhook:**

It is an HTTP callback triggered by specific events, allowing one service to send data or notifications to another when something relevant occurs. Webhooks are commonly used for automation, data synchronization, and updating external systems.

Here are some steps to add Webhook to your Jenkins.

* Open the GitHub repository.
    
* Go to “settings” and then to “hooks”.
    
* Click the “Add webhook” button.
    
* Fill out the form as shown in the image below. Provide the URL of Jenkins in the webhook and add github-webhook/ at the end. You can disable SSL verifications if you don't have valid SSL for your Jenkins server. Then you can choose option "Calling the webhook only for push events" (depending on your purpose of using the webhook)
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695644791345/158542b3-64d0-4df4-a141-691ac1638daa.png align="left")

Once webhook is connected it will show green tick.

**Task-01 :**

**Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.**

Generate the SSH keys for integrating your Jenkins project with your git repository. Use the **ssh-keygen** command to create public and private keys.

Open the Linux server and type **ssh-keygen**

Now redirect to cd .ssh & explore the public and private key

Now get the public key, "cat id\_[**rsa.pub**](http://rsa.pub/)**" and copy the public key.**

Then open the GitHub setting page and go to SSH & GPG key,Add the public key that we created using ssh-keygen and select key-type **Authentication key.**

### **Set up a pipeline for a Node Todo application.**

step 1: Create a new item and choose a free-style project and named it.

Select GitHub to project to paste the repository URL

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695296002792/f347f0f1-c8a2-47e0-9c9a-9bd1c0085acd.png align="center")

Now, go to Source code management to configure GitHub to Jenkins. Provide the GitHub URL where the code exists. Use the secret text option to provide credentials to Jenkins.

Kind: SSH Username with the private key

ID: github-jenkins

Description: This is for jenkins and GitHub integration

Username: ubuntu

Private Key: Enter directly (cat id\_rsa)

Add

Now select the credentials.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1683901894648/24116975-6ce1-42d1-b3df-090ad501a333.png?auto=compress,format&format=webp align="left")

Now, go to Build Steps and choose the execute shell build option.

```markdown
 docker build . -t node-todo-app

 docker run -p 8000:8000 -d node-todo-app:latest
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695295942899/899a7057-b58c-4fc0-94fa-97f46f43d958.png align="center")

Now click on build now. Hence Code is taken from github.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695296050401/d3c74bba-2ce1-45ff-b7da-162d8bd8b1e1.png align="center")

# Task-02: Use docker-compose in execute shell.

In the Execute shell run the application using Docker compose.

Install docker-compose.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695362592891/dd75fe0d-0cbe-4010-987b-696b43fff472.png align="center")

Make a docker-compose file.

Run the project

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695362717469/69369ec9-570b-4a3c-97c3-d805db6c23c7.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695643796677/1a9bfe5f-a399-44a2-8a05-5f623529ae51.png align="center")

Hence we have run the project using GitHub integration with Jenkins with docker-compose.Thank you so much for reading so far and supporting me.

Kavita Pant.
