alex_aldo - Fotolia

Tip

Practical ways to automate microservices' CI/CD processes

Development teams need to make applications extensible and agile. Microservices bring those goals in sight, but an automated CI/CD pipeline is the key to success.

Automation is a powerful way to make an organization more efficient, if application architectures are built for it. Through effective business process automation and digital transformation practices, an organization can streamline and automate tasks, but these practices don't harmonize with legacy monolithic application architectures. Legacy applications were never built to support today's levels of automation. An automated CI/CD approach to deliver microservices complements modern needs.

A suitable architecture for automation

Digitally enabled organizations need an extensible, agile and adaptable software architecture. Monolithic architectures are more difficult to update and change and, in some ways, harder to debug than microservices. This is because a monolithic application is a single, tightly knit unit, so if you change one thing, you need to change every part of the application.

A microservices architecture is a more sustainable long-term application strategy. Microservices architectures are adaptable because each service is independent, so if any new technology sprouts up to replace any one of your services, you can easily make the change without disrupting the entire system. Successful microservices endeavors by the likes of Amazon, Netflix, eBay and others prove that this architecture is here to stay.

Automating microservices' CI/CD

The individual parts of a microservices-based application should be easy to test, deploy and move. Automating the CI/CD processes for microservices enables the level of agility that this architecture is capable of. With CI, developers update code in a repository on a continuing schedule, such as several times a day. CI pipelines execute automated builds and tests to measure code quality. Some CI pipeline tools include Jenkins and Jenkins X, Atlassian Bamboo and GitLab.

CI emphasizes test automation at the point when the CI server integrates new commits into a main branch. Architecture changes not only significantly affect how the IT organization tests its applications, but also what they are tested for. Unit testing, where a single module's code is tested for functionality, validates that the smallest pieces of software behave as expected. Once the team develops and integrates all modules, integration tests reveal any issues that arise when the code interacts.

Microservices communicate with each other in too many permutations and combinations for this integration testing approach. Unit tests, however, are great candidates for automation. And in a microservices-on-CI/CD workflow, you can conveniently use a number of existing unit testing frameworks. However, prepare to keep integration tests to a minimum, and monitor systems in production for any issues that occur. When moving from monolithic systems to more fine-grained services, your strategy will need to focus more on live monitoring and alerting, rather than preproduction testing for every possible scenario.

Continuous delivery, which handles code release and operation in live production, is more complex to automate than CI. While a lot of organizations claim to have an automated CI/CD pipeline, most actually combine automated CI with manual CD. With truly automated CD, all code changes through CI automatically publish to a staging environment, where they're tested and readied to deploy live via a predefined deployment process. The goal is to always have your code up to date and production-ready. With many tools to choose from, Spinnaker and Helm are specifically two that can automate this process, especially with Kubernetes container orchestration.

A microservices-based architecture can advantageously result in a far more efficient use of resources than a monolithic one. Microservices pair naturally with cloud hosting and serverless instances, rather than the established hosting model of servers and VMs for legacy applications. By automating critical microservices CI/CD processes, you can drastically improve the benefits you reap from this architectural choice.

Dig Deeper on Application development and design