What are the CI/CD pitfalls and how to avoid them?

Oshini Nugapitiya
9 min readJun 12, 2022

Although DevOps is one of the most ambiguous concepts in software development, most of us accept that it is defined by five activities: continuous integration, continuous delivery, cloud computing, test automation and configuration management. You do DevOps if you do these five points. Obviously, all five are critical to getting right but they are all pretty easy to get wrong. Continuous integration and continuous distribution (CI/CD), in particular, can be the most complex DevOps moves to master.

Continuous integration (CI) is a process that involves developers and testers collaboratively to verify new code. Developers used to write code and integrate it once a month for testing purposes. That was inconvenient since an error in the code from four weeks ago might force the developers to go back and rewrite the code from the previous week. To address this problem, CI tends to rely on automation to constantly integrate and validate code. Scrum teams who use CI commit code at least once per day, and the majority of them commit code for every modification introduced.

Continuous distribution (CD) is the process of producing releasable objects on a continuous basis. Several businesses deliver applications to consumers once or even several times a day, while others distribute them at a slower rate due to market conditions. In every scenario, the potential to release is truly tested on a regular basis. Cloud computing makes continuous integration feasible. The servers are configured so that you can deploy to production without having to shut them down and manually update them.

As a result, CI/CD is a process for developing, evaluating, and delivering new code continuously. For example, Facebook and Netflix use CI/CD to create 10 or more releases every week. Other organizations find it difficult to compete when they succumbed to one or more of the five vulnerabilities, I will address next.

Pitfall 1 : Automating the incorrect process first.

This is a common pitfall for companies transitioning from waterfall development to DevOps. New businesses have the benefit of implementing CI/CD from scratch. Existing companies must be gradually transforming from manual to highly automated development. Since the complete transformation will take several months, you must be iterative in your approach to CI/CD adoption.

“Does this need to be automated now?” you might wonder. Go through the following checklist:

1. How often does the procedure or situation recur?

2. How long will the procedure take?

3. Who is involved in the process, and what resources are they relying on? Are they triggering CI/CD delays?

4. If the procedure isn’t automated, is it vulnerable to errors?

5. Why is it so important to automate the process?

You will use this checklist to prioritize the steps in a CI/CD execution. First and foremost, simplify the compilation process. Preferably, you should integrate code several times per day (1). Manually, the procedure will take a few minutes to a couple of hours (2). That causes output to be blocked until the programmer completes the task (3). It is also prone to human error (4), which is critical because CI/CD is a pipe dream without automatic integration (5).

We could use the same checklist on testing as well. You might wonder whether you should automate functional testing or UI testing first when you switch to CI/CD. Both will be reiterated at least once a day (1). For a medium-sized application, both will take 2 to 3 hours (2). However, they contain several dependencies (3). You will not need to change the automation script more often if you automate functional testing. On the other hand, the UI is constantly changing and requiring regular script updates. Even though both are vulnerable to errors (4), you can consider functional testing before UI testing to make the most use of your resources (5).

Let’s go through the process of establishing environments one more time. Whether you’re on a recruiting spree or have a lot of churns, this situation will come up regularly (1). It’s a lengthy procedure that can take many hours, if not days (2). Without environments, new team members can’t do something useful, so obviously there’s a dependency and a lag (3). I wouldn’t assume the procedure is vulnerable to errors (4) but is it really necessary (5)? I’m inclined to say yes, but I’d place integration and functional testing first.

There are no such things as too much automation. You would automate anything if you had endless resources. However, complete test automation is impossible to obtain. Sometimes you may break down tasks into smaller segments and automate in patches. Sometimes you should actually document the procedure in detail and implement it manually.

Pitfall 2 : Continuous deployment can be misunderstood as continuous distribution.

Continuous deployment refers to the idea that if the pipeline’s results are adequate, any improvement made to the code base will be deployed almost immediately to manufacturing. Most companies are terrified of this because frequent product updates will drive customers away.

Companies assume that they are not performing CD if they do not conduct continuous deployment. They don’t know the difference between a continuous distribution and continuous deployment.

Any update to the code base goes through the pipeline before it is deployed to non-production environments, which is known as continuous delivery. The team discovers and fixes bugs instantly, rather than waiting until the code base is ready to be released.

The codebase is always of a high standard to be released. It’s a corporate decision whether to deliver the codebase to production.

Although most companies are reluctant about continuous deployment, they are excited over continuous delivery. They have more authority over product rollout, functionality, and risk factors with continuous delivery. There will be time for alpha training, beta customers, early adopters and other activities.

Pitfall 3 : Insufficiency of meaningful dashboards and metrics.

In CI/CD implementation, the scrum team can build a dashboard until members realize what they need to monitor. As a consequence, the team be overwhelmed by logical fallacy: “These are the metrics we have, so they must be significant.” Instead, do a systematic evaluation before creating a dashboard.

Different members of an IT organization and even members of a scrum team have different interests. For example, those who work in a network operation center (NOC), adore red, yellow and green signs. NOC workers should identify issues using traffic light dashboards instead of understanding complex text or putting their analytical skills. Hundreds of servers can be managed with the aid of traffic lights.

You may be tempted to use a traffic light dashboard for CI/CD as well. Green is to indicate that we are on the right track. Yellow is to indicate that we’ve been off track, but we have a roadmap to get back on track while red is for indicating that we’ve been off track and will most likely need to change our goals.

A scrum master will certainly benefit from that dashboard, but what about the VP of development or the CTO? If a scrum team has 350 hours of work ahead of them over a two-week spring, where each of its 10 participants is responsible for 35 hours, they will each earn 35 story points. Upper management may be more interested in the “burn-down” rate, or the rate at which tasks are completed, than in the status of story points. Are our team members responsible for their own loads? How soon do you think that would happen? Are they becoming better over time?

Unfortunately, if the different stakeholders do not understand the scrum team’s agreed-upon habits, burn-down rates may be misleading. As they go, certain teams burn down points more quickly. Others hold off on burning down open points until after the end of the sprint. This should be reflected in the dashboard.

You can design a useful dashboard if you can determine what data everyone needs and build a common narrative about what the data represents. However, don’t stress over substance at the cost of substance. Ask some questions on how stakeholders expect it to appear. Is it better to use diagrams, text, or numbers?

In a progressive evaluation, these are the aspects to consider at. They demonstrate how difficult it is to create a useful CI/CD dashboard that pleases all. Very frequently, the most outspoken team member takes control of the process, leaving others dissatisfied that the dashboard caters to only one person’s needs. All should be noticed.

Pitfall 4 : Continuous integration and continuous distribution aren’t really coordinated.

This pitfall brings us back to our DevOps standard concept, which states that continuous integration and continuous delivery are two separate things. CD is fueled by CI. It takes months and a lot of teamwork to set up a good continuous integration pipeline and a complete continuous delivery system. Quality assurance, DevOps, ops developers, and scrum masters all have a role to play. This human element, rather than any of the technological challenges we’ve addressed, could be the most difficult part of CI/CD. Collaboration and teamwork cannot be programmed in the same way as a positive interaction between the two individuals cannot be programmed.

Benchmark the CI/CD procedure against the best in the industry to determine this degree of collaboration. Netflix, for example, will finish integration, testing, and execution in two or three hours. They developed a technique for passing code from hand to hand without hesitation or negotiation. No, it isn’t fully automatic because modern technology makes that impossible.

Pitfall 5 : Maintaining a balance between the frequency of running continuous integration jobs and resource utilization.

Any time an update is made to the code, a continuous integration job is expected to be activated. Successful jobs enable modification to take place, while failures refuse them. Developers are encouraged to check in smaller blocks of code, resulting in more builds every day. On the other hand, unnecessary continuous integration jobs consume resources, which is wasting time and money.

The program can be broken down into smaller components to build faster-running pipelines since this approach involves a lot of resources (CPU, power, and time). Alternatively, the continuous integration roles should be set up to do batch check-ins that are checked locally first. The aim is to strike a balance between the frequency at which continuous integration jobs are performed and resource utilization.

Don’t get carried away: There are a variety of resources and features on the market, the great majority of which may or may not be needed for a specific use case. So think about what’s right for your software delivery and just use the modules that go with it. If there is a segment of the procedure, such as unit testing, which is not robust and has more problems, automate it until it becomes mature; otherwise, you will end up wasting more time than benefit to automating it.

Don’t write large testing scripts: Instead, write small scripts with fixed features that you can reuse in your pipeline whenever required.

Execute local unit tests: Before pushing to the central repository, run test cases locally on the developer computer for business-specific scenarios. It adds an additional layer of authentication which assures that there are fewer integration problems.

Build a pipeline that is focused on the method rather than the tools: This is an era of disruption. Software distribution services are increasingly developing. Tools that are adequate today will not be adequate tomorrow (like in a few years). As a response, design architecture in such a way that you are not depending on tools. Make an effort to host the code repository on cloud platforms that have limitless encrypted storage. The other advantage is that the data is held in a single location away from computing machines, making it very simple to switch to new services and applications.

Place the right component in the right place: Place the right stage in the right place based on the use case. The aim must be to save time by starting with the closure of high-failure pipeline components. You would want to package first and then run several test cases in parallel, for example.

Avoid constructing CI/CD in-house: There are several free and low-cost open-source and paid resources available. The key aim of CI/CD is to free up developer resources so that they can be used for more important tasks. In-house systems would necessarily require a significant initial investment as well as ongoing maintenance. The objective of the pipeline should be to make CI/CD as smooth as possible.

Use cloud-native applications: Major cloud providers such as AWS and Azure offer the opportunity to create a full CI/CD pipeline using native or common services. Additionally, go as serverless as possible to save money on regular maintenance and concentrate on performance.

--

--