What Can CI/CD Do For You?
Continuous Integration and Continuous Deployment (CI/CD) are processes that enable rapid integration of new validated code to multiple environments. This is achieved by creating pipelines that automatically build, test, and deploy any new commits made to a repo. As an automated process, this guarantees that the code will be built and tested the same way, every time new code is pushed to source control.
With these pipelines, developers can focus on building and shipping new features and bug fixes, rather than spending valuable time building, testing, and deploying. The idea of CI/CD is to create one or more pipelines that help software companies manufacture and ship better software faster.
“There should be two tasks for a human being to perform to deploy software into a development, test, or production environment: to pick the version and environment and to press the “deploy” button.”
― David Farley, Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation
What is CI/CD? (Continuous Integrations & Continuous Deployment)
The two parts of the CI/CD process break down into streamlining and automating the process of development and deployment. Continuous Integration is used to integrate new code by building and testing every single commit. The results of these builds and tests are reviewed by development teams to determine whether the new code should be merged into the main branch of the repo. These build versions can then be rolled out to various environments (Continuous Delivery/Deployment) as often as desired with the expectation that the builds are stable.
With CI pipelines, developers don’t need to schedule builds or tests against multiple features at once. Rather, new features and bug fixes are treated as atomic changes and can be built and tested independently of any other new features or bug fixes. Any issues that arise from testing the new changes can be attributed to only that specific change. Developers would no longer have to spend time tracing which specific feature or fix is causing a build or tests to fail.
Designing and implementing CI/CD pipelines is non-trivial, but investing time and resources into building a well-designed system will reward development teams and end users alike. Automating away the arduous task of building and validating new code leads to increased development velocity and delivery to customers.
The workflow will look something like Figure 1.
Figure 1: Example CI Pipeline.
Key Components and Benefits of CI/CD
Automate everything possible: similar to the GitOps paradigm, everything in a CI/CD system should be automated. Software project builds and tests should be scripted and integrated into CI/CD pipelines, and the underlying build environment infrastructure and its configuration should be configured as code.
Maintain meticulous version control: Versioning software artifacts is crucial for keeping track of what artifacts contain which features. When implementing a CI/CD pipeline, versioning strategies should be built in, whether incremental or semantically with commit hashes or feature names. They key here is that a CI/CD system is agnostic to what strategy a team chooses to employ. When the pipeline is run, any resulting artifacts are automatically versioned according to the strategy.
Test rigorously with automated processes: The software needs to be tested to identify any potential bugs, but other issues such as code that reduces performance may need to be evaluated before integrating changes.
Integrate changes frequently: Merge conflicts and unintended functionality conflicts between features arise regularly in environments where large or multiple changes are integrated into a repo all at once. With a CI/CD system, changes should be made atomically and frequently. Small changes reduce the scope of conflicts, and integrating each small change frequently results in faster, more reliable development.
Integrate testing into builds: Test suites are important for validating and ensuring that new code behaves as expected. Running these test suites manually slows development velocity by relying on running a long regression testing cycle that tests against a batch of new features and fixes at once. This bottleneck is eliminated by codifying test suites and integrating them directly into CI/CD pipelines. With this, each new atomic change is tested against the full regression test suite and verified at built time. Any other test suites, such as integration or browser tests, should be integrated as well.
Monitor client feedback: Clients don't always know exactly what they are looking for or what they need. An implementation of a feature may not be what was expected. With a CI/CD system, development teams can focus on building the software to meet the client’s needs without having to worry about the complications of building and delivering it.
About Your Implementation
While it may be difficult to employ the CI/CD workflow from scratch, there are products on the market that can help. These can help lead you through process setup. It is quite possible that all of the features of CI/CD are not desirable for every development environment. However, it’s not an all or none solution. CI/CD systems are highly customizable, and you can implement only what you need.
While Figure 1 does cover a basic idea of how the process works different stages can be built into the CI/CD pipeline. Developers, Business Analysts, DevOps Engineers and others in an organization's production team can take on checks that help them perform their specific roles at particular points in the process. Stages can be added just as well as removed.
In all, the general movement toward agile development has greatly enhanced the productivity and relevance of software and companies who produce it. The initial investment and learning curve may be an apparent potential detour of resources, but it is for the short term and necessary for competing in the current market.
If you’re interested in a readiness assessment to validate your organization's ability to implement a proper CI/CD pipeline, feel free to contact us.