9 CI/CD for API artifacts 2: Build-stage and API configuration deployment

 

This chapter covers

  • Transforming API definitions in the pipeline
  • Publishing generated API artifacts to an artifact store
  • Creating SDKs and mock APIs
  • Deploying API gateway configuration

In chapter 8, I discussed source-stage governance controls to help teams apply automated governance checks to API definitions at the API-design stage. After the definitions have been reviewed and approved, the API team may need to do the following:

  • Generate artifacts from the API definition. These artifacts can include SDKs, alternative API definition formats, and human-readable API reference documentation for the developer portal.
  • Deploy the API service to higher environments.
  • Deploy the API gateway configuration.
  • Test the implemented API for conformance.

This chapter details how to perform these tasks in the deployment pipeline, which lies in the Build stage and the Deploy and Test stage (figure 9.1).

Figure 9.1 The APIOps practices discussed in this chapter
figure

This hands-on chapter is aimed primarily at developers who need to set up a deployment pipeline to deploy and publish APIs. You’ll walk through an example of setting up a pipeline to generate and publish API artifacts to internal API artifact stores using GitHub Actions. You’ll implement deploying API configuration in two open source API gateways using an APIOps (i.e., GitOps-based) workflow.

9.1 Build stage: Transforming API definition files

9.1.1 Updating the pipeline code

9.1.2 Storing API definitions in an API registry

9.2 Build stage: Simulating APIs with mocks

9.2.1 Benefits of API simulations

9.2.2 Types of mock APIs and mock tool modes

9.2.3 Using mock APIs to test for real-world scenarios

9.3 Build stage: Generating and storing SDKs

9.3.1 Benefits of providing an SDK