CI/CD pipelines are an integral tool for both SRE and DevOps, but what is so special about CI/CD pipelines and how do they work.
"To improve is to change; to be perfect is to change often." Winston Churchill
From the highest level, CI/CD is a small piece of code that upon being notified copies code from one place, reads some of that code to find dependencies (other code) and integrates them. Then runs some checks, and if they pass, it will copy everything over to another place, normally a server.
The code is normally copied from a code repository like GitHub, BitBucket or Perforce.
The notification could be when a developer has added new code to a repository or a scheduled event.
The dependencies are code libraries that contain commonly used methods, such as methods to make it easier to add text to a browser, or cryptographic functions to help with authentication and authorization.
The checks are called static-code-analysis, which could do a number of things:
Check the code for common security vulnerabilities
Run a set of unit tests or integration tests to check that the new version does everything the old version did
Ensure that the code is laid out correctly and readable
So the continuous means that it's always available, such as when code is pushed. Integration covers pulling in additional code from other course and deployment is copying or deploying that code to the server.
Bear in mind this is a very simplified version, and CI/CD can be extended to deploy a whole environment with thousands of servers and the associated configuration for those servers. CI/CD is extensively used in all stages of development, from initial project creation, testing, production, monitoring and even destruction.
What this means for SRE and DevOps
CI/CD supports the following SRE principles
Operations is a software problem
Work to minimize toil
Automate this year's job away
and, additionally supports these DevOps Principles
Change should be gradual
Measurement
As CI/CD are programs or scripts, they automatically fall into the category of software, and even though they are an immensely useful tools. Not all development teams use them, some still manually copy code from their development environment to production. This is a huge amount of toil.
Imagine a software developer copying all the code from one machine to the other, much like if every time you wanted to cook a meal you made a distinct trip to the supermarket to buy only the specific ingredients you needed for that meal, then threw away all excess ingredients. How much time would you waste going to the shop, waste in petrol and waste in food.
That's why we want to automate this process, spend some extra time building a CI/CD to allow us to do many code change in a day and get feedback on each deployment. We can use the CI/CD we built to measure our rate of change in terms of the number of deployments we do. We can also measure the quality of code produce by the team and feed that back to developers, so we can increase our velocity.
As our ultimate goal is to increase reliability and velocity by allowing small gradual tested changes, and even if something goes wrong we have a centralized CI/CD which logs all changes and feed into our monitoring/alerting system.
Conclusion
In this article, I've described that a CI/CD allows us to increase the team's velocity, by automating deployment of an application. While at the same time, the deployment is tested for quality. Using a CI/CD allow us to measure the success of our platform and our team and massively reduces toil.
I hope you have enjoyed reading this article and if you want more please subscribe to my mailing list. I write articles weekly on topics of DevOps and SRE.
I'm Jonathan Weems and offer consultancy services to businesses of all sizes, who are looking to improve their platforms' reliability or adopt any of the principles in SRE, DevOps or Agile. Feel free to book a free 45 minutes call to discuss improvements you are looking to make.
Other Posts
https://www.serverdevs.com/post/what-is-an-sre - Explains the role of an SRE
https://www.serverdevs.com/post/what-is-devops - Explores DevOps Principles
https://www.serverdevs.com/post/what-is-devops - Compares Devops and SRE
Comments