Your First CI Pipeline
Small Changes, Big Impact
At the heart of continuous integration and continuous deployment (CI/CD) is the idea that the earlier you get feedback from your code, the better. This is because the earlier you catch defects, the cheaper they are to fix. This is why CI/CD is so important. It allows you to find problems at an early stage, usually by the time you commit and push your code to a shared repository.
When a developer pushes code to a Git repository, a CI server automatically in a typical CI/CD pipeline:
- Builds the code,
- Runs unit tests to check if the code works as expected and has no regressions on existing features.
- Runs static code analysis to check for code quality and coding style issues.
- Generates documentation and other artifacts.
- Deploys the code to a staging environment for further testing if you prefer. This is called Continuous Deployment and it's optional at some point (some companies don't do it at all or do it semi-automatically with manual approvals).
ℹ️ The developer, by pushing code to the repository frequently and early, triggers the different tasks and tools and has the opportunity to get feedback quickly. Small iterative changes are easier to understand, review, and fix than large changes that are pushed all at once. Accumulating changes over time can lead to merge conflicts, regressions, and other issues that are hard to diagnose and fix.
Here is another non-exhaustive list of tasks that can be automated in a CI/CD pipeline:
Continuous Integration Tasks:
- Building the code to download dependencies and/or compile the source code.
- Running unit tests to check if the code works as expected.
- Running static code analysis to check for code quality and coding style issues.
- Running integration tests to check if different parts of the code work together as expected.
- Running code quality checks to enforce coding standards and best practices.
- Generating documentation to help developers and all stakeholders understand the code and its usage.
Continuous Delivery Tasks:
- Creating a release, a tag, or a package to distribute the code easily and in a standardized way.
- Building container images to package the code and its dependencies in a portable way.
- Pushing or pulling container images to or from a container registry to store and share them.
Continuous Deployment Tasks:
- Deploying the code to a staging or a production environment to make it available to users and the whole team involved.
- Running performance tests to check if the code meets the required performance criteria.
- Running end-to-end tests to check if the code works as expected from the user's perspective.
ChatOps Tasks:
Cloud Native CI/CD with GitLab
From Commit to Production ReadyEnroll now to unlock all content and receive all future updates for free.
