7 CI/CD pipelines as code

 

This chapter covers

  • Designing a CI/CD pipeline as code on GCP
  • Two-stage deployments for separating static and dynamic infrastructure
  • Iterating over complex types with for_each expressions and dynamic blocks
  • Implicit vs. explicit providers
  • Creating custom resources with local-exec provisioners

CI/CD stands for continuous integration (CI) / continuous deployment (CD). It refers to the DevOps practice of enforcing automation in every step of software delivery. Teams that practice a culture of CI/CD are proven to be more agile and able to deploy code changes more quickly than teams who do not practice a culture of CI/CD. There is also the ancillary benefit of improving software quality, as faster code delivery tends to result in smaller, less risky deployments.

A CI/CD pipeline is a process that describes how code gets from version control systems through to end users. Each stage of a CI/CD pipeline performs a discreet task such as building, unit testing, and publishing application source code (see figure 7.1).

Figure 7.1 A CI/CD pipeline has multiple stages that automate the flow of software delivery.
CH07_F01_Winkler

7.1 A tale of two deployments

7.2 CI/CD for Docker containers on GCP

7.2.1 Designing the pipeline

7.2.2 Detailed engineering

7.3 Initial workspace setup

7.3.1 Organizing the directory structure

7.4 Dynamic configurations and provisioners

7.4.1 for_each vs. count

7.4.2 Executing scripts with provisioners

7.4.3 Null resource with a local-exec provisioner

7.4.4 Dealing with repeating configuration blocks

7.4.5 Dynamic blocks: Rare boys

7.5 Configuring a serverless container