Today's applications are very complex. Continuous Integration and Continuous delivery, also known as CI/CD, aide in building these complex applications and ensuring they provide end users with a quality experience.
CI/CD is just one aspect of DevOps. The goal of CI/CD and DevOps is consistency and quality through automation. The more you automate repeatable processes, the more likely those processes are to succeed. When repeatable processes aren't the responsibility of people, those people are freed up to add value. CI/CD addresses some of the most common, repeatable development processes, enabling developers to create more value.
Most applications have multiple developers making contributions to a project. A project can have hundreds of thousands of lines of code being modified by dozens of developers across many teams. A project with that many lines of code is fragile. An incorrect change to a single line can bring the whole app crashing down. Developers are human, they make mistakes. Every single change to the code base needs to be tested. With the pace of changes made, manually testing all these changes would add a lot of overhead.
To avoid that overhead, automation is introduced. Along with features, developers also write tests to ensure features are working correctly. These tests are run every time a change to the code base is made. That's Continuous Integration. Every time a developer modifies the code base, the application is built and tested.
These tests have a wide scope. At the most basic level are unit tests which mostly just test basic functions and business logic. Applications don't just have business logic. They work with various other technologies like the internet, databases, and messaging queues. Integration tests test the application when it's connected to these services. Some applications talk to other applications. For example, an iOS app will talk to a backend server application. Testing an iOS app connected to a backend is called an end-to-end test. End-to-end tests cover all aspects of your application.
Continuous Integration does all this work in an automated fashion. To run end-to-end tests, an automated process will build and deploy your applications then run all the tests. If tests fail, notifications are sent out and developers can correct any behavior. If all the tests pass, then the next step in the process starts.
As mentioned in the previous section, today's applications connect to a variety of services. These services are organized into environments. Applications are configurable to run in multiple environments. This enables developers to work on applications without worrying about destroying production data. Part of Continuous Delivery is building applications for various environments. Through Continuous Delivery an application can be built for development, test, and production environments. This is done by providing configuration files to an automated build tool. After the application is configured and built, it's delivered to the corresponding environment.
After the application is built, it needs to be shipped to customers or deployed to production environments. Sometimes this is as simple as deploying your code base to your server. Other times, there are complex steps involved like code signing when publishing an application to the iOS App Store. Or distributing your web client to multiple content delivery servers all over the world to give users quick access to your product.
All these steps can be done by a developer sitting at a machine entering commands into a terminal. Testers can manually run through all the uses cases of an application. A release manager can manually click a button to deploy an application to the App Store. But, humans make mistakes and end users don't like mistakes. CI/CD reduces the risk of these mistakes by automating repeatable processes.
The ideal state of CI/CD is achieved when any developer in an organization can apply a code change at any time, have it tested, and deployed to end users in a short amount of time with confidence. This is possible when an organization dedicates to a strong CI/CD process. CI/CD is just code automating processes. That code needs to be maintained just like any other code base. When done correctly, developers are freed from the monotony of complicated build processes and enabled to add value to applications.