Know the common mistakes in CI CD (Continous Intergration and Continuous Deployment)

Continuous Integration and Continuous Deployment
The conversation around DevOps and CI (Continuous Integration) and CD (Continuous Deployment) has only been growing louder. As DevOps cements itself as a dependable development methodology, CI and CD emerge as the powerlifters that reduce errors while increasing project velocity.

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

 

The conversation around DevOps and CI (Continuous Integration) and CD (Continuous Deployment) has only been growing louder.

As DevOps cements itself as a dependable development methodology, CI and CD emerge as the power lifters that reduce errors while increasing project velocity.

The goals of CI and CD are quite straightforward. The continuous integration process should be simple and easily repeatable. Since developers carry out the integration more frequently than at the end of the development cycle, you can detect integration bugs early, thereby improving software quality.

CD automates the software delivery process to ensure assured deployments into production. CD automates each step of the building delivery and ensures that new features and software changes can be released safely, quickly, and reliably always.

Companies such as Netflix and Facebook have implemented CI and CD to achieve more than 10 releases per week. But for every company that is successful with CI and CD, there are others that struggle. And more often than not this is down to some very avoidable mistakes. A look at these common mistakes also gives us some insights into what could be considered as CI-CD best practices.

1. The CI CD pipeline conundrum

Should you keep your CI-CD pipelines fast or should you create a rigid pipeline design? Flexibility is the hallmark of DevOps. When it comes to CI and CD it is the pipeline that helps spearhead the change from the automated testing cycles through to the staging environment to production.

Quite obviously, the more comprehensive your testing pipeline the better your chances of not having to field bugs in the production environment. Keeping pipelines fast and dependable thus becomes imperative to maintain project velocity.

A rigid design here impedes the development team’s capability to optimize processes. After all, it is quite common to do things in parallel and not serially. DevOps pipelines have to be more structured but not rigid. They should be strong and defined and yet be flexible to incorporate sudden changes.

2. Not securing the CI and CD environment

Your CI and CD system has complete access to your codebase and credentials to deploy in several environments. This is huge from the operational security standpoint. Those looking at DevOps and CI/CD quite logically think of this system as a high-value target. After all, the primary purpose of CI and CD is to produce reliable software. So how can security be an afterthought? Some of the common errors that derail any agile Continuous Integration initiative (and should be avoided at all costs) are:

  • Not tracking logins to the CI/CD system
  • Not employing static analysis tools
  • Not scanning third-party code for security
  • Not scanning the code for vulnerabilities once it is deployed in the development environment
  • Having lenient internal networking rules

Security has to be ingrained in every step of the CI and CD process. And while it might seem that the project is slowing down, remember that security must not be compromised for speed.

3. CI and CD = No manual testing

Test automation plays a big role in CI and CD. However, does extensive automation mean zero manual testing? Do we need specific Continuous Integration testing tools?

You cannot have a world-class CI/CD pipeline by completely eliminating manual testing. There will be some aspects of testing that ‘will’ need human intervention and analysis. Without manual testing, you might come close to developing a good CI/CD pipeline but such a pipeline will never be built for greatness.

Thus, instead of eliminating, think about integrating manual testing efforts into the pipeline. And it is only once the manual testing of certain test cases are done that you should go into the deployment phase.

4. Expend too much time unit testing

Yes, unit testing is critical. But when it comes to CI/CD you have to take certain considerations into account.

Unit tests are brittle and hence unless your code stabilizes completely it is counterproductive to spend too much energy on the same. Projects in the initial phases of CI/CD witness a lot of rewrites, new libraries, etc. At such times, unit tests become huge overheads.

Acceptance tests are better candidates here. They help you assess if the rewritten code to counter a problem is working as intended or not.

5. Differences between staging and production

Maintaining parity with production environments plays an important role in the success of DevOps and Continuous Delivery initiatives. All changes in the CI/CD pipeline are done through a series of test suites and deployment environments. You can use Continuous Testing and push all the changes closer to production.

However, reproducing the production environment as closely as possible in the testing environment is essential. Differences in the staging and production environment can allow bugs or problematic changes to the production environment. The result? Poor quality and a faulty product.

While it might not be possible to have zero differences in the staging and production environment, the differences have to be manageable, and the environmental differences well-defined.

6. Is branching uncontrollable?

CI/CD integrate changes in a shared repository. This is done early and often. It solves the challenge of costly integration problems when multiple developers merge divergent and often, conflicting changes in the main branch of the repository while preparing the release.

Having too many branches impedes the CI/CD system’s ability to track and monitor the codes. Such untracked branches may have reams of untested code. This adds to project liability. Eventually, it impacts the project momentum and ultimately its success.

7. You don’t test locally

Testing is a recurring theme in the CI/CD environment. Developers have to be careful not only about what they test but also where they test.

If your team commits the code to the shared repository before testing it locally, you could be potentially creating roadblocks for your other team members. It is also unlikely that the local developer environment might run the entire test suite in a production-like environment. So what can you do?

  • Test locally, using a test suite that can be run from any environment
  • Use the same commands, as developers use on their local machine, in CI/CD system to test code merged to the repository,
  • Employ a shell script or makefile to automate running the testing tools in a repeatable, predictable manner
  • Containerize testing environments to increase the portability of your testing infrastructure

As a parting note, there is no ‘one size fits all’ approach that you can take with CI and CD. Each implementation will be different. The aspects and specifications will vary. But then, being aware of these common pitfalls will strengthen your CI and CD initiatives. And that can deliver you to project a success!

Subscribe To Our Newsletter

Get updates and learn from the best

You may like to read this

UI Test Automation – what’s possible and what is not

The central reasons to automate any business task are speed and convenience. Think of the consumers opting to get a dishwasher. They want to eliminate the drudgery of washing utensils and the time and the…
ui over ux

Taking The Step From UI To UX

Terms such as user experience (UX) and User Interface (UI) are commonly used and are now in uber-focus while discussing web or mobile application development. In fact, many use these two terms interchangeably. Some others…
Scroll to Top