The ideal situation is when a task comes in from the business in the morning, developers refine the code within a few hours, push it to the repository, and within minutes, the end user has the new features working. Achieving this is only possible if you have a great team of experts working simultaneously with the code and infrastructure using DevOps practices.
CI/CD is one of the basic concepts related to Agile and DevOps methodology. It consists of two fundamental elements - Continuous Integration (CI) and Continuous Delivery (CD). Let's start with continuous integration.
People are forgetful, prone to fatigue, and generally perform boring routine tasks poorly, especially those requiring long-term focus on something very monotonous. Solving a complex creative task after 15 cups of coffee? No problem. Checking a hundred parameters in 37 manual tests for the 74th time during another deployment? People can't handle that even once.
A skilled DevOps expert, can solve this problem. To begin with, the entire concept of working with code is restructured. The main task is to ensure that developers merge code as often as possible in small atomic portions. DevOps configures automated pipelines using tools like Gitlab or Jenkins, so that every tiny piece of code won't reach users unless it meets all requirements.
A typical scenario without CI usually looks like this:
- A developer gets a task to fix a small bug.
- The developer pushes their patch to the repository and goes for another coffee.
- Two months later, it turns out this patch broke critical functionality elsewhere, which is used every few months.
With CI, the same scenario looks different:
- The developer pushes their patch to the repository.
- An automated pipeline starts.
- Linters check the code for syntax correctness, e.g., Pylint or RuboCop.
- Code style is checked to ensure all team members write in a consistent style, simplifying collaboration. Believe me, inconsistency is very irritating to developers.
- Unit tests are executed. Unit tests check individual parts of your code.
- Static code analysis is performed. Your code is checked for vulnerabilities and issues, even those that appeared in open databases a few hours ago. Tools like SonarQube might be used here.
- Dependency assembly and verification. All necessary elements are compiled, packaged, and sent to the company's artifact repository.
- Integration testing. The ready elements are deployed on test infrastructure, simulating typical behavior to evaluate the interaction of all parts of the architecture.
This extensive list above is impossible to perform manually after each minor code change. If you have a well-configured CI, you can be sure that your patch won't break something that already worked. You won't need to spend time on manual checks. As a result, code that has passed the CI pipeline automatically meets your quality standards. Any changes that don't pass the tests won't reach the production branch.
At WiseOps, for instance, we adhere to quite strict internal code standards, ensuring the uniformity and reliability of the final product.