Complete Jenkins CI/CD Project[Day 24 Task]

Complete Jenkins CI/CD Project[Day 24 Task]

Task-01

  • Fork this repository:

    • 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

Step 1:

  • Start your Jenkins instance and log in to your Jenkins dashboard.

  • Then Fork this node-todo-cicd repository in your GitHub account.

Step 2:

Create a Freestyle project and give it a name.

Step 3:

Give a description of your project and give your GitHub project URL.

Step 3:

Choose git under the source code management section and give the proper URL of your code repo.

Step 4:

Under the Build Triggers section choose the GitHub hook trigger for GITScm polling.

Step 5:

Now, create a connection with Jenkins and GitHub.

Go to the Manage Jenkins option from your Jenkins dashboard.

Then choose the manage plugins option --> then install a plugin for GitHub integration with Jenkins.

GitHub Integration Plugin,,

Install and restart Jenkins

Step 6:

Now go to GitHub and choose the repository that you want to make the integration with Jenkins.

Choose the settings option from your repository

Choose a webhook option and add a webhook as per the image [jenkins url followed by github-webhook]

Note: If your Jenkins URL is localhost you need to use a public IP, so for that just install ngrok, Connect your account, and write ngrok cmd ngrok HTTP 8080.

Added successfully.

  • Now GitHub and Jenkins are integrated successfully with the help of Webhook...So whenever you make any changes in your code repository in Github it will automatically trigger in Jenkins and will deploy that changes successfully every time.

    What Github Webhook is?

    A GitHub webhook is a feature provided by the GitHub platform that allows you to set up and configure events to trigger HTTP POST requests to a specified URL whenever certain actions or activities occur within a GitHub repository. This mechanism enables developers and teams to automate various tasks and integrate GitHub repositories with external systems or services.

    Task 2

    • In the Execute shell run the application using Docker compose

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

    • Run the project and give yourself a treat:)

  1. In the build steps section of your above-mentioned project in Jenkins,

Add the below command to your shell script and save it.

Now you can build the job manually but as per today's task will do it with the help of the webhook trigger and it will start to build automatically.

  • Make some changes in the code and try to keep a look at your Jenkins dashboard

  • Job triggers automatically as you can see from the image.

  • This is the console output.