CI/CD Pipelines and Test Environments in Production
Understand the key stages of CI/CD pipelines including source control, build, static analysis, and testing phases. Learn how test environments simulate production systems safely and why blue-green deployment and traffic partitioning help mitigate risks when testing in live production. This lesson guides you through practical techniques to integrate automated testing effectively while protecting your production environment.
Practical CI/CD pipelines
Most projects use a CI tool to handle the sequencing chores. Popular tools are provided by Jenkins, GitLab, CircleCI, Travis CI, and Azure DevOps. They all work similarly, executing separate build stages sequentially. That’s where the name pipeline comes from—it resembles a pipe being loaded at one end with the next build stage and coming out of the other end of the pipe, as shown in the following illustration:
A CI pipeline comprises the following steps:
Source control: Having a common location to store the code is essential to CI/CD. It is the place where code gets integrated. The pipeline starts here by pulling down the latest version of the source code and performing a clean build. This prevents errors caused by older versions of code present on the computer.
Build: In this step, we run a build script to download all the required libraries, compile all the code, and link it together. The output is something that can be executed, typically a single Java archive .jar file, to run on the JVM.
Static code analysis: Linters and other analysis tools check the source code for stylistic violations, such as variable length and naming conventions. The development team can choose to fail the build when specific ...