Imagine you are a DevOps engineer at a company. On a bright day, you receive 20 projects that need deployment. You perform all tasks manually, from deploying Frontend, Backend, Database, and Build to Monitoring, not to mention Security steps… It takes you 30 minutes to an hour to complete each deployment. This causes delays in all projects as each project has to wait while others are being built and deployed.
DevOps engineers wonder: “Why don’t we create a process to automate Build, Testing, and Deployment based on existing scripts?” And thus, the concept of CI/CD was born.
CI/CD is a combination of CI (Continuous Integration) and CD (Continuous Delivery) or Continuous Deployment, referring to the processes of integrating (integration) frequently and quickly with code and frequently updating new versions (delivery).
Continuous Integration (CI) is a method in software development where developers continuously integrate (merge) new code into a main branch, usually develop
or master
. Every time new code is integrated, the CI system automatically builds the project and runs tests to ensure that the new code does not introduce errors or disrupt the current system.
The main goal of CI is to detect errors early in the development process, minimize risks, and ensure that the software is always in a releasable state. A typical CI system includes steps such as:
Continuous Delivery (CD) is a method in software development where code changes (new features, improvements, bug fixes) are automatically built, tested, and prepared for release to production quickly and consistently. CD extends from Continuous Integration (CI) and emphasizes getting the software to a state where it can be released at any time.
The main goal of Continuous Delivery is to ensure that the code is always in a releasable state, meaning the code has been built, tested, and prepared for deployment with just a push of a button.
Continuous Deployment is an extension of Continuous Delivery (CD), where code changes are automatically deployed to production environments immediately after passing all testing stages. No human intervention is needed; each code change (after passing automated tests) is directly deployed to the live product.
In Continuous Deployment, every commit that passes the testing process is automatically deployed to production. This helps keep the software continuously updated, providing new features, bug fixes, and performance improvements as soon as they are ready.
Example of a CI/CD Pipeline:
GitLab CI/CD has two main components:
This is a process using GitLab-integrated CI/CD.
develop
branch, which triggers GitLab Runner to read the .gitlab-ci.yml
file.Imagine that on GitLab Runner, there would be a Jenkins Agent as shown below.