Day 24 : Jenkins CI/CD Project
Let’s make a beautiful CI/CD Pipeline for your Node JS Application
Task-01
- Fork this repository:
Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.
Generate the SSH keys for integrating your Jenkins project with your git repository. Use ssh-keygen command to create public and private key.
Configuring GitHub
Go to your GitHub account settings.
Go to "SSH and GPG" keys and click on "New SSH key", Add public key (i.e. id_rsa.pub) that we created using ssh-keygen and select key-type Authentication key.
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 and click on "Add webhook".
Installing GitHub Integration plugin in Jenkins :
Open your jenkins dashboard.
Click on the Manage Jenkins button on your Jenkins dashboard.
Click on Plugins->Available plugins.
Install GitHub Integration plugin.
Configuring Jenkins :
Click on "Create a job" to create a new project.
Enter a name for your project (e.g., "node-todo-app").
Select "Freestyle project" and click "OK" to create the project.
In Configure, GitHub project URL write your project GitHub URL
In Git, add credentials for jenkins
Add private key which we created using ssh-keygen command.
Click on the ‘Build Triggers’ tab and then on the ‘GitHub hook trigger for GITScm polling’.
Task-02
In the Execute shell run the application using Docker compose.
Click On Save.
You will have to make a Docker Compose file for this Project.
After build you can check console output.
Using docker ps command, you can see container is created.
Browse public IP address with port no.8000
Conclusion
Integrating Jenkins with GitHub via GitHub Integration simplifies your CI/CD workflows, enabling automated builds, streamlined deployments, and improved collaboration among development teams. By following the steps outlined in this blog post, you can create a seamless connection between your Jenkins jobs and GitHub repositories, enhancing productivity and software delivery efficiency. Embrace the power of automation and collaboration to accelerate your development processes and deliver high-quality software consistently.
I'm confident that this article will prove to be valuable, helping you discover new insights and learn something enriching .
thank you : )
Subscribe to my newsletter
Read articles from Prathmesh Vibhute directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by