Jenkins CI/CD pipeline
2 min read
Jenkins
Jenkins is a tool 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 continuously integrate projects(jobs) or end-to-endpoint automation.
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 eg: Git, Maven 2 project, Amazon EC2, HTML publisher, etc.
What is Web Hooks?
Webhooks are a way for web applications to communicate with each other in a real-time or near-real-time manner. They are a mechanism for automatically triggering actions or notifications in one system based on events occurring in another system.
In the context of Jenkins, webhooks are often used to integrate Jenkins with other tools or services. When certain events occur in Jenkins, such as a build being completed or a code repository being updated, Jenkins can send an HTTP POST request to a specified URL, a webhook endpoint. The receiving system, often an external service, can process the webhook payload and perform the desired actions.
How to set up Webhooks to pull code from GitHub
Create a new project in Jenkins by checking Github Project and adding Repo URL
Now check Git as a source code manager.
at Build triggers, check the GitHub hook trigger for GITScm polling.
add Build steps and save.
Now, open the repo in GitHub -> setting -> Webhook -> add Webhook
add payload URL and content-type application/json
How to create a Node CI pipeline
create a Node with a field pipeline checked
add GitHub repo which is set up with webhooks
Add pipeline scripts and save
Congratulation🎉 you made a CI pipeline with Jenkins.
Thanks for your patient reading
happy learning!!