Complete Jenkins CI/CD Project👩💻🚀
In the fast-paced world of software development, efficient Continuous Integration and Continuous Deployment (CI/CD) pipelines have become crucial. These pipelines streamline the process of delivering high-quality code to production while minimizing manual interventions and errors. Among the many CI/CD tools available, Jenkins remains a popular choice due to its flexibility and robustness.
In this guide, we'll take you through the journey of setting up a complete Jenkins CI/CD project. 🎉
Prerequisites👩💻
Before we dive into the steps, make sure you have the following ready:
Jenkins installed and running
A version control system (e.g., GitHub) repository with your project code.
Step 1: Creating a Jenkins Job 🛠️
Login to Jenkins: Access Jenkins through your browser and log in.
Create a New Job: Click on "New Item," give your job a name (e.g., "MyAwesomeApp-CI"), and select "Freestyle project."
Under the "General" section, choose "Github project" and provide the repository URL.
Configure Source Code Management (SCM): Under the "Source Code Management" section, choose your version control system (e.g., Git). Provide the repository URL and credentials if required.
Build Triggers: Choose how your pipeline starts. Now to integrate github and Jenkins we need to create Github Webhooks. Select the " GitHub hook trigger for Gitscm Polling"
To create Webhook: Go to Settings of your forked GitHub repo. and select Webhook.
Add webhook:
Provide payload URL: The payload URL should be jenkins_public_ip:8080/github-webhook/
Click on Add Webhook
Build Steps: Add build steps, such as compiling code, running tests, and creating artifacts.
Step 2: Make changes in the Dockerfile📝
Now make some changes to the code, e.g. adding a comment at the beginning of the docker file and commit the changes.
Now you can see Job in the Jenkins dashboard starts to build automatically.
And the build is successful.
To view the output, click on console output.
Step 3:Access the web app✨
As stated in the Docker file instructions, access your Jenkins instance's security group settings and include a new rule for port 8000 to enable webpage access.
Then, copy your Jenkins public IP followed by ":8000" and paste it into a new browser tab to view the webpage.
Conclusion 🌟
Congratulations! You've successfully set up a complete Jenkins CI/CD pipeline that automates the build, test, and deployment processes of your software project. This not only saves time but also enhances the reliability of your software releases. Remember, CI/CD is a journey of continuous improvement. Feel free to explore more advanced features, plugins, and best practices to further refine your pipeline. Happy coding! 👩💻👨💻🚀