CI/CD consists of 2 parts : Continuous Integration and Continuous Delivery(Deployment). These are methods used in software development to make the process of writing, testing, and deploying code faster and smoother.
Continuous Integration
Continuous Integration is a process where you integrate a set of tools or a set of processes that you follow before delivering your application to the customer. This is where the developers regularly add their code toa shared project. Various steps such a unit testing, static code analysis, Automated testing and building and reports are then carried out automatically.
Unit testing: Individual functions or blocks of code are tested separately.
Static code analysis: The code is checked for syntactical errors, indentation, formatting, etc.
Code quality / vulnerability: Code is checked for vulnerabilities.
Automated testing: Every time new code is added, tests are run automatically to check for errors.
Build Automation: Code is compiled into a form the computer can understand automatically.
Continuous Delivery/Deployment
Continuous Delivery is a process where you deploy or deliver your application on a desired platform. This is where the application is packaged and made ready to be shipped to the end users. In continuous delivery, the code is automatically deployed to a environment other than the production environment. Whereas if the code is deployed to the production environment, it is called as continuous deployment. Continuous Deployment is the final step in delivering the application to the customers.
Why is CICD important?
CICD increases the speed to deliver a software. Developers don’t have to wait for weeks or months to release a product. Every time code is pushed to a version control system, it is automatically built, tested and deployed instantly. Automated testing ensures that bugs are caught early. This increases the quality of the of the software. CICD also enables collaboration between teams.
Key Components
Version control
Software code is stored and managed collectively using tools like git.
Check out following article to read more about Version control systems
Automated Testing
Every time code is added, it is tested automatically to check for errors.
Build Automations
Code is compiled automatically
Deployment
Code is moved to a server where users can access it.
CICD Pipeline
A CICD pipeline consists of 4 main steps : Code, Build, Test and Deploy. At first, developers write the code and share it to a version control system like GitHub. Tools like Jenkins watch for any changes made to the repository and whenever code is pushed, it triggers automated tests and then the code is automatically built. The code is then automatically deployed to desired environments like dev, test, stage, and prod.
Common CICD tools
Jenkins: An open-source tool that automates building and testing.
GitHub Actions: A CI/CD tool integrated with GitHub.
GitLab CI/CD: Comes with GitLab for managing pipelines.
Azure DevOps: A Microsoft tool for managing the entire CI/CD process.
Challenges in CICD
Complexity of Setup:
Description: Setting up a CI/CD pipeline requires careful planning, configuration, and integration of tools.
Example: Choosing and integrating tools like Jenkins, Docker, or Kubernetes can be overwhelming for teams new to CI/CD.
Cost:
Description: CI/CD tools, cloud resources, and skilled professionals can be expensive.
Example: Running automated tests on every code commit can increase costs, especially in large projects.
Tooling Integration:
Description: Ensuring that all tools in the CI/CD pipeline (e.g., version control, testing frameworks, and deployment tools) work together can be challenging.
Example: A misconfigured webhook between GitHub and Jenkins can break the pipeline.
Overhead for Small Projects:
Description: For small projects with limited resources, setting up CI/CD can feel like overkill.
Example: A two-person team might find it easier to use manual methods rather than maintaining an entire pipeline.