
In Chapter 10, you learned about the laboratory and how you could automate the process of build, deploy, and test for applications on your local machine to provide rapid feedback. This is known as the inner loop.
The factory is the automated process that builds and deploys the application to the cloud, as shown in Figure 12-1. The factory is the outer loop (see Figure 12-2). It is made up of two parts, the build pipeline (the assembly line) and the deployment pipeline (the delivery truck and installation engineer).

Figure 12-2. Outer loop
The build pipeline takes the raw materials and the source code and turns it into a containerized service. This means that whenever a developer commits a change to the source code repository, the build pipeline will automatically build, test, and store the containerized service.
The test suite will typically include all unit tests and, usually, integration tests. This is known as continuous integration (Figure 12-3). Building applications in this way means that you can get rapid feedback on the quality of the code and the impact of any changes; however, hopefully, you would have picked up most issues earlier by testing in the inner loop in the laboratory.

Figure 12-3. Continuous integration
By building and testing in a consistent and automated way, you can be confident that the application will work as expected when deployed. By adding security controls and checks on dependencies and the build process, you can also be confident that the application will be secure and reliable. This is known as securing the software supply chain and is discussed in depth at Supply-Chain Levels for Software Artifacts, or SLSA.
This is similar to the goal of a real factory—to reliably produce a product of consistent quality.
The deployment pipeline takes the containerized service and deploys it to the cloud. This is known as continuous deployment if deployment to a production deployment is fully automated, as shown in Figure 12-4. If deployment is optional or deployment is only automatic to test environments, it is known as continuous delivery.

Figure 12-4. Continuous integration and deployment (CI/CD)
Tip
In reality, continuous deployment to production is not always possible. For example, if you are deploying to a regulated environment, you may need to have a manual approval step. This is still continuous delivery but not continuous deployment. However, if the automated tests in your pipeline are comprehensive enough, you can be confident that the application will work as expected when deployed; therefore, continuous deployment is a useful tool.
Think of this again like buying a new washing machine. The machine is built and tested at a factory and stored in a warehouse. It is then delivered, and you have the choice to have it installed (deployed) at the same time or do it yourself later.