Day 24 - Complete CI/CD Jenkins Project

Day 24 - Complete CI/CD Jenkins Project

ยท

3 min read

๐Ÿš€ Day 24 of #90daysofdevopschallenge! Let's craft a stunning CI/CD Pipeline for your Node JS App! ๐ŸŒˆ But before we dive in, let's decode GitHub webhooks and master the art of connecting GitHub with Jenkins. ๐Ÿ•ต๏ธโ€โ™‚๏ธโœจ

GitHub Webhooks:

GitHub webhooks, your silent CI/CD partner! ๐Ÿค– They notify you about events like code pushes, PRs, and more. Perfect for automating tasks like building, testing, and deploying code. ๐Ÿš€

What Are Webhooks and Why Would You Use Them? | Make

GitHub webhooks have superpowers:

๐Ÿš€ They go beyond CI/CD pipelines.

๐Ÿ› ๏ธ Handy for automated testing, issue tracking, and project management.

๐Ÿšจ Great for deployment, release management, and chat integration.

๐Ÿค– Custom workflows and integrations? Absolutely!

๐Ÿ” Plus, they help with security and compliance. ๐Ÿ›ก๏ธ

In a nutshell, GitHub webhooks make your code collaboration smoother and more automated! ๐Ÿค–

Benefits of Jenkins GitHub Webhooks:

Jenkins GitHub Webhook is a DevOps gem! ๐Ÿ’Ž Speeds up development, resolves issues swiftly, and automates the build, test, and deployment processes across platforms. ๐Ÿค–๐Ÿ’จ

Hands-on CI/CD project! ๐Ÿ’ช๐Ÿ”ง

Task-1: Getting Started with Jenkins and GitHub for CI/CD using GitHub Webhooks

๐Ÿ› ๏ธ Step 1: Fork the Repository

Head to github.com/Nilkanth1010/node-todo-cicd.git

and hit "Fork" to create your copy.

๐Ÿ› ๏ธ Step 2: Create a Freestyle Project in Jenkins

Log in, click "New Item," name your project, select "Freestyle project," and click "OK".

๐Ÿ› ๏ธ Step 3: Configure Repository URL In project settings, select "Git," paste your forked repo's URL, and provide SSH credentials.

๐Ÿ› ๏ธ Step 4: Setting Up Connection Between GitHub & Jenkins Generate SSH keys, add to GitHub, and configure the build steps in Jenkins.

๐Ÿ› ๏ธ Step 5: Scroll down to Build Steps Use 'execute shell' to build and run your Node JS app in Docker

Go to build steps and select the execute shell option.

docker build . -t node_todo_app 
docker run -p 8000:8000 -d node_todo_app

๐Ÿ› ๏ธ Step 6: Setting Up Webhook Manage Jenkins, install GitHub integration plugin, and add a webhook in your GitHub repo settings.

๐Ÿ› ๏ธ Step 7: Go to Build Triggers Configure GitHub Hook trigger for GITScm pooling

Task-02: Execute Shell for Docker Compose Enhance your Jenkins job by configuring Docker Compose and deployment script.

# Stop and remove the existing containers 
docker-compose down 
docker build -t nodo-todo . 
docker-compose up -d --name web1

Conclusion: Jenkins GitHub webhook integration, your key to seamless CI/CD! ๐Ÿงฉ Follow these steps, set up, and test your Jenkins GitHub webhook integration to automate your code's build and testing. Stay tuned for more Jenkins insights in the next article! ๐Ÿš€๐Ÿ”

Did you find this article valuable?

Support Nilkanth Mistry by becoming a sponsor. Any amount is appreciated!

ย