#Day 31 Jenkin CI/CD Project

CI/CD pipeline using Jenkins

#Day 31  Jenkin CI/CD Project

Let's make a beautiful CI/CD Pipeline for your Node JS Application

Task-01

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

Read About GitHub WebHooks and make sure you have a CICD setup.

Github WebHooks

  • GitHub Webhooks are a feature of the GitHub platform that allows 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.

Add Github Webhook

  • Go to your GitHub repository and click on Settings.

  • Click on Webhooks and then click on Add Webhook.

  • In the ‘Payload URL’ field, paste your Jenkins environment URL. At the end of this URL add /GitHub-webhook/. In the ‘Content type’ select: ‘application/json’ and leave the ‘Secret’ field empty.

Install the GitHub Integration plugin in Jenkins

  • Open your Jenkins dashboard.

  • Click on the Manage Jenkins button on your Jenkins dashboard

  • Click on Manage Plugins

  • Install the GitHub Integration plugin

Creating a new Freestyle Project for the node.js application

  • Create a new Freestyle Project for the node.js application

  • Enter the GitHub repo URL.

  • Select “Git” From Source Code Management and paste GitHub repo URL.

  • Select ‘GitHub hook trigger for GITScm polling’ from Build Triggers.

  • Once the connection between the Jenkins server and Github is successful a green tick as highlighted below will be shown.

Task-02

In the Execute shell run the application using Docker compose

  • Click on configure.

  • Select Execute shell from the dropdown menu to add a shell command to the build.

  • In the command field, enter the following command
    docker-compose down

    docker-compose up -d --build web

  • build the web services back to back from docker-compose

  • docker-compose -d --no-deps --build web

  • Click on the build button and the build is successful and the application is running on the browser.

  • I have changed a line and committed changes in GitHub and did not click on the build, and the build is started automatically and changes are also seen on the browser.

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

Thank you for reading!!
~Mecrin D Luvis

Great initiative by the #trainwithshubham community. Thank you Shubham Londhe

#devops #90daysofdevops #jenkins #cicd #jenkinsproject #jenkinscicdproject