Day 23 Task: Jenkins Freestyle Project for DevOps Engineers.ππ€π©βπ»
What is CI/CD?ππ
Continuous Integration (CI):
What it is: Continuous Integration is the practice of frequently integrating code changes from multiple contributors into a shared repository. Each integration triggers an automated build and test process to identify and address issues early in the development cycle.π€
Why it's important: CI helps prevent integration problems by catching errors quickly, ensuring that the codebase remains stable and ready for deployment at any time.π¨ποΈ
Continuous Delivery (CD):
What it is: Continuous Delivery is the practice of ensuring that code changes are always in a deployable state. This involves automating the entire software delivery process, from building and testing to deployment, in a way that allows for manual approval before releasing to production.π
Why it's important: CD ensures that your software is always ready for deployment, reducing the time and effort required to release new features or bug fixes.β©π
Continuous Deployment (CD):
What it is: Continuous Deployment is an extension of Continuous Delivery where every code change that passes automated testing is automatically deployed to the production environment without manual intervention.ππ
Why it's important: CD takes automation to the next level, allowing for faster and more frequent releases. It streamlines the delivery process and ensures that valuable features and fixes reach users quickly.β‘π
Key Benefits:ποΈπ
Less Issues: Catching and fixing problems early. π§βπ§
Faster Releases: Quicker delivery of new features. π
Reliable Deployments: Consistent and error-free releases. π οΈ
Better Collaboration: Improved teamwork among developers. π€
Early Bug Detection: Identifying and fixing bugs promptly. π
Quick Feedback: Rapid response to the impact of code changes. π©
What are the principles of CI/CD?ππ¦
Frequent Code Integrationπ:
- Developers regularly integrate their code changes into a shared repository to ensure that the codebase is continuously updated and works well together.
Automated Buildsπ€ποΈ:
- The integration process triggers automated builds, compiling the code and creating executable artifacts to ensure consistency and reliability in the build process.
Automated Testingπ€π§ͺ:
- Automated tests are run on the integrated code to quickly identify and address errors, ensuring that the code remains functional and bug-free.
Continuous Feedbackπ©:
- Developers receive quick feedback on the success or failure of their code changes, allowing for rapid identification and resolution of issues.
Deployment Readinessπ:
- Every code change is maintained in a deployable state, ensuring that the software is always ready for deployment.
Automated Deploymentππ€:
- The entire software delivery process, from building and testing to deployment, is automated to ensure consistency and reduce manual errors.
Configuration as Codeπ§°π»:
- Infrastructure and configuration are managed as code, making the deployment process more predictable and reproducible.
Environment Parityπ:
- Development, testing, and production environments are kept as similar as possible, reducing the likelihood of deployment issues due to environmental differences.
Collaboration and Communicationπ€π¬:
- Foster collaboration and communication among development, testing, and operations teams to ensure a smooth and efficient workflow.
Version Controlππ:
- Code changes are tracked using version control systems (e.g., Git), providing a history of modifications and enabling easy collaboration among team members.
Manual Approval (in CD)π€π:
- Before releasing to production, there is an option for manual approval. This step ensures that stakeholders have an opportunity to review and authorize the deployment.
Rollback Mechanism (in CD)β©οΈπ:
- A reliable rollback mechanism is in place in case any issues are detected post-deployment, ensuring quick recovery from unexpected problems.
How does CI/CD work?π€π©βπ»π
Code Changes Trigger π:
When a developer makes changes to the code and pushes it to a shared space (like Git), it's like raising a flag saying, "Hey, I've got something new!"
Automated Build and Test π οΈπ§ͺ:
A smart robot (automation) takes the code changes, builds them like constructing a Lego tower, and tests them to make sure everything fits together without errors.
Deploy Readiness Check π¦:
The system checks if the code changes are ready for deployment, making sure everything is in order like packing a suitcase for a trip.
Automatic Deployment π:
If everything looks good, another automation takes over and deploys the code changes to where it needs to go, like a magical delivery service making sure the package reaches its destination.
What Is a Build Job?ποΈ
A Build Job is like a special task assigned to a helpful robot in our team. π€ Its main job is to take the code we've written and put it together in a way that's super organized.
When we tell the robot to start the Build Job, it takes all our code and carefully arranges it, making sure everything fits perfectly. Think of it as organizing a messy room into a neat and tidy space. Once it's done, we have a neat package ready to use.π¦β¨
The Build Job is crucial because it helps us find and fix any issues in our code early on. It's like having a diligent assistant who ensures everything is in order before we move on to the next steps in our project.π΅οΈββοΈπ
What is Freestyle Projects?ππ οΈ
"Freestyle Project" refers to a type of project configuration that provides a flexible and easy-to-use way to define and execute tasks in Jenkinsπ οΈ. It allows users to create jobs or projects using a graphical user interface without the need for scripting or coding knowledge.
Freestyle Projects are user-friendly and suitable for simpler automation needs. They are accessible for users who may not have advanced scripting skills. However, for more complex or scripted workflows, Jenkins provides other project types like πPipeline Projects, which allow you to define your π€automation process using code (typically written in Groovy scripting language).
Tasksππ€
Task-01
- Create a agent for your app.
Use ssh method to create agent node
- Create a new Jenkins freestyle project for your app.
- In the "Build" section of the project, add a build step to run the "docker build" command to build the image for the container.
- Add a second step to run the "docker run" command to start a container using the image created in step 3.
Task-02
- Create Jenkins project to run "docker-compose up -d" command to start the multiple containers defined in the compose file.
- Set up a cleanup step in the Jenkins project to run "docker-compose down" command to stop and remove the containers defined in the compose file.
π Thank you for taking the time to explore this blog!π I hope you found the information both helpful and insightful.β¨
π Enjoy your learning journey, and don't hesitate to reach out if you have any feedback. π€ Happy exploring!
Subscribe to my newsletter
Read articles from Anusha Nayak directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Anusha Nayak
Anusha Nayak
Hi everyone, I am Anusha Nayak. πI am passionate about bridging the realms of development and operations to propel efficient and seamless software delivery! π» As a DevOps professional, I'm all about making things run smoother, like cutting out unnecessary steps, setting up automatic software installations, and making sure everything flows together nicelyπ¨βπ». I want to help teams create great software quickly every single time.