What makes an outstanding CI/CD pipeline?
An outstanding CI/CD pipeline contains a few basic features: speed, reliability, automation, accuracy, and consistency. Learn how to get the most out of them.
What is CI/CD?
CI/CD refers to Continuous Integration, Continuous Delivery, and Continuous Deployment, and yeah, CICDCD was not as good an acronym. It lacked that ACDC vibe. These practices combined provide a streamlined framework that produces software faster and with fewer defects.
CI/CD bridges the gap between development and operations, becoming an essential part of DevOps culture, a topic that we have covered before. Diving into DevOps culture and building upon Agile methodologies is the perfect rule of thumb to prevent from following CI/CD technical aspects blindly.
If you closely follow the new trends in technology, you are probably aware of the cultural change across the board in work environments and development methodology. Implementing outstanding CI/CD pipelines provides faster delivery cycles and forms the backbone of modern-day DevOps. Times are a’changin.
CI: Continuous Integration
Continuous Integration (CI) provides a consistent and automated way to build, test, and package applications. It maximizes committing code changes as it speeds up processes to augment their frequency. Thanks to this, CI boosts software quality and collaboration across your team. Developers will ideally be merging their code changes into a shared repository frequently, maybe even many times a day—as opposed to the ways of the past when Git merges happened once a quarter or even a year, and they were Hell. As GitHub and many other automation tools emerged, this process became streamlined.
Nowadays, everyone works on the latest version of the code and deployments that took countless hours now can be done in minutes. That allows for error and integration bugs to be detected earlier and rectified quickly, reducing the maintenance and bug fixing time and cost. With the new build triggered automatically on each merge, manual intervention is limited. Even the build tests are automated, creating a baseline for quality control.
CD: Continuous Delivery
Continuous Delivery (CD) makes it possible to build features, fix bugs, and make configuration changes for release quickly, safely, and sustainably. Thanks to automation, the whole process is less error-prone, as tests are associated with each code build, once again providing a quality assurance baseline. Continuous Delivery reduces the time taken to deploy code into production, providing speed and reliability to the development team.
CD: Continuous Deployment
Continuous Deployment (also CD) is very similar to Continuous Delivery but implies a specific setup: every code change is automatically deployed to the production system without having to wait for approval. This ultimate version requires no manual intervention minimizing human errors and providing a fast track for development. This is Frieza's final form.
That’s all good and shiny, but you came here for the CI/CD pipeline. We have seen its components, but how does it all work together? The pipeline is the assembly line composed by CI and both CDs in service of software development. An automated pipeline for the software delivery process allows the DevOps team to deliver quality software sustainably.
CI/CD pipelines help produce bug-free code at high velocity eliminating manual errors and providing a standardized feedback loop. The CI/CD pipeline is often built upon four stages.
Here is the starting point: the source stage, where all begins. It indicates the creation of the source code repository and is associated with Git push commands.
The second stage is the build stage, which consists of compiling to build a runnable instance. Cloud-native software is deployed as containers either with Kubernetes or Docker.
The test stage is the third one. Here automated tests are used to validate the accuracy and viability of the code.
The fourth and last stage is the deploy stage. Here multiple deployment environments are considered, and software is eventually sent to production.
What are the benefits of CI/CD pipelines?
You might still be thinking: hey, you promised an outstanding pipeline; where is it? Well, good things take time, so let’s talk before about the general benefits of a CI/CD pipeline, even an okay one.
A CI/CD pipeline can help break down barriers and remove silos, bringing developers, administrators and operators together as a true team. Kind of an Avengers assemble sequence, where everyone is seated except that one that has a standup desk.
No more manual integration by developers! (This sounds like an infomercial, but it is true.) Where before you had infrequent code merges, now they are executed daily. In the past, it may have taken a lot of time to see a broken functionality; now, the burning hell can turn into little daily manageable fires.
This change in the development culture is not all about the dev team. It comes with changes in the customers' demands. With increased productivity, efficiency, new patches, and functionalities, users are more fast-paced than ever before. They feel the need, the need for speed.
Aside from increased productivity and merges, CI/CD pipelines foster collaboration and efficiency and boosts the time to market. That allows production to throw out more dependable releases: less risk, smaller deployment footprint, and easy to locate bugs facilitate bug fixing and problem resolution.
This change in development affects how companies assess risk. With a low risk of catastrophic failure, thanks to the reduced probability and magnitude of the failure, other risks can be taken. Fail safe, fail smart, fail often. That leads to prioritizing deployments that release on demand, shortening the release cycle, and creating frictionless deployment operations.
More application products and features while reducing bugs and errors can vastly increase customer sentiment. Small bugs, quick fixes; you could learn a bit of that triple-A, crunch-prone game industry.
How does CI/CD prevent human error?
CI/CD pipelines work in conjunction with DevOps culture, taking down barriers and providing sensible automation to the table. Thanks to these advances, we can reduce human errors by removing menial manual tasks that do not please anyone.To build, test, and deploy automation, CI/CD adds a streamlined pipeline to move things forward—a technique associated with The Toyota Way.
This desire for continuous improvement is in line with the reduction of human error. By automating boring and repetitive tasks, developers and IT professionals can focus on the most significant and demanding issues, the ones that only humans can fix. Human error can never be eliminated. But we do not want that because we might be destroying the possibility of fortuitous discoveries: serendipity. It is not a bug; it is a feature.
GitHub Actions and CI/CD
As a writer, I fundamentally need explanations from devs, IT, and many other specialists to avoid falling for rookie mistakes or bringing home useless data. During one of my quests, I was fishing for information on GitHub's actions and how they articulate with the CI/CD pipelines. That’s when I found TechWorld with Nana and her video, GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker.
Sometimes you just need to accept defeat and show how someone does what you can’t. If you are looking for a comprehensive guide of GitHub actions and their integration to CI/CD, you can find the link to her video below.
What makes an outstanding CI/CD pipeline?
We have already discussed the benefits of a good CI/CD pipeline, but what about an outstanding one? Let's present some bullet points for creating the CI/CD pipeline to stay competitive in the current times.
Speed is key, as the time to each commit limits how much developers can deploy in a day, being one of the major blockers in production.
- Have your pipeline built for speed. Gotta go fast!
- Shortened feedback cycle: ensure quick feedback and viability of a build. Reduce time to build, test and deploy an app from initial coding to production
- Reduce the Mean Time To Resolution by using small integrations and deployments
- Use micro-agility by testing and committing code frequently
Reliability can sometimes seem like a word from the past, the kind of adjective that described your grandpa's fridge or the cars from the forties. With programmed obsolescence, many lost their faith in technology. Let's bring reliability to the technosphere back.
- Reliability: be sure to set a stabilized output.
- Comprehension: when planning to cover as many aspects as possible, there is always something else that could go wrong. Find it before it happens.
- Deliver any version of the code at any time: do not block your developers and IT specialists. Having the freedom to go back to earlier versions or deploy at any time can help reliability by fostering independence and accountability.
Accuracy is something to aim for. I am sorry, puns are not my forte, but this aspect should be in your pipeline.
- Accuracy: run and visualize the entire software delivery process ahead of time, fully automated.
- Do more with less: work with what you have, resist the temptation of going bigger. Fight off the bloat.
- Make it secure: many are already talking about DevSecOps. Accuracy is also preventing things from landing in undesired places.
Consistency is something that, as a software developer, you might have inherited from Fordism and Modernism. It is essential to provide a reliable and evergreen product.
- Always use the same processes and artifacts across the pipeline to keep deployments consistent.
- Stay consistent across all environments. Every level of complexity can play against you over time.
- Two bullet points? That doesn't look good. I need a third one.
We have already talked about automation tools and how it helps save time in DevOps culture. CI/CD pipelines also use automation tools extensively to operate.
- Automation: you know the drill, as little manual interaction as possible.
- Automated tests: this means automated QA and testing in production-like environments, allowing you a one-click promotion to actual production.
- Fully-automated deployments: from build to production in a few minutes.
- Automation all across the board: this can simplify crucial points in the software development life cycle (SLDC), adding to speed, reliability, consistency, and accuracy.
Rules of thumb
We have imported a set of rules from Excella, so I will not hide them behind paraphrasing. You can find them listed here or go to their page (sources below) for a thorough explanation.
- No check-ins when the build is broken
- Run tests and code analysis before check-in
- Refresh the database for data-driven tests
- Automated acceptance tests (AATs)
- Delegate enforcement to each team
- Report metrics visibly to all teams and management
- Require pull requests
- Peer code review of each story
My favorite rule is the last one, peer code review of each story. This heuristic stems from scientific research and can help catch bugs before they creep into production. It also provides a space that fosters developers learning from each other while reducing the chance of breaking the build in solitary.
TL;DR? An outstanding CI/CD pipeline relies on speed, reliability, accuracy, consistency, and automation. Strive for a setup that lets you build, test and deploy using the minimum amount of time and resources.
Pipelines in a software factory
CI/CD pipelines are crucial in a software factory, as we run them to deliver digital products consistently. We already covered how a software factory works, and a suitable pipeline is our assembly line. As we provide standardized procedures and software development, we cannot improvise and create artisanal solutions for every product. A model is necessary to make a fast and reliable software development life cycle. To provide our customers with the best service, we use GitLab, SonarQube, Ansible, and Kubernetes, among others. You can see our choice of the 10 best open-source tools for DevOps.
At Awkbit, as a software factory, we rely on planning ahead and setting up the best possible CI/CD pipeline. We need the features that DevOps culture brings to the table, and we tweak and tinker with our systems as often as possible to provide the best outcomes. Do you need help setting up your own CI/CD pipeline? Would you like to know more about how to save time with DevOps?
Sources & further reading
- GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline with Docker
- What is CI/CD? (CI/CD basics, features, tools & more)
- DevOps CI/CD Explained in 100 Seconds
- How to Implement an Effective CI/CD Pipeline
- 8 Ways to Keep Your CI/CD Pipeline Working for You
- The History of 'It's Not a Bug, It's a Feature'