Jenkins CI/CD Project

·

2 min read

Jenkins is an open-source automation tool written in Java programming language that allows continuous integration - continuous delivery and deployment.

Jenkins is a tool that is used for automation, and it is an open-source server that allows all the developers to build, test and deploy software. It works or runs on Java as it is written in Java. By using Jenkins we can make a continuous integration of projects(jobs) or end-to-endpoint automation.

Jenkins provides hundreds of plugins to support building, deploying and automating any project.

Jenkins achieves Continuous Integration with the help of plugins. Plugins allow the integration of Various DevOps stages. If you want to integrate a particular tool, you need to install the plugins for that tool. For example Git, Maven 2 project, Amazon EC2, HTML publisher etc.

How to install Jenkins on Mac follow the link https://medium.com/@ibrahims/how-to-install-and-configure-jenkins-on-the-mac-os-4ef11ecc94cc

Create a freestyle pipeline to print "Hello World!!

Create a job with a freestyle project

We can select the choice according to the requirement in SCM, Build Triggers and Build Environment options. but here I am not selecting anything as I have to Create a freestyle pipeline to print "Hello World!!

In the below image, In the "Build" option, click on the "Add build step" button and choose "Execute shell".

In the shell command field, enter the below command to print "Hello World!!" to the console:

Save the job configuration

Now, we click on "Build Now" to run the job. we will see the output "Hello World!!" in the console output of the build.

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

Enter your name and click on freestyle project and finally click on ok.

Provide GitHub URL.

Click on Build Steps and select Execute Shell.

Click on job->configure and select “GitHub hook trigger for GITScm polling

Add a webhook. To add it, follow the section given below.

Make any changes in the GitHub repo and edit any header file. The job will run automatically and changes will be made.

Adding Jenkins Webhook in Github

Open the GitHub repository.

Go to “settings” and then to “hooks”.

Click the “Add webhook” button. Enter “<Jenkins url>//GitHub-webhook/” Payload URL. Click on Add Webhook

Automatically trigger the pipeline in Jenkins