Overview

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

This chapter explains how API teams extend CI/CD beyond code compilation to handle API artifacts produced after design approval. It shows how a pipeline can transform OpenAPI definitions by bundling multi-file specs, filtering out internal endpoints and unused components, sorting fields for consistency, and then storing the resulting artifact in an API registry or similar store so downstream stages can reuse it. The chapter also frames these activities as part of the build stage, where API definitions may be repackaged for external publication, documentation, or later automation.

It then explores how API simulations and SDK generation fit into the same build workflow. API mocks and stubs help teams continue development before the real service is ready, support isolated testing, and make it easier to reproduce real-world conditions such as latency or variable responses. The chapter also shows how to generate client SDKs from OpenAPI definitions, why SDKs improve developer experience, and what tradeoffs come with maintaining them, including versioning, language-specific upkeep, and release management. Generated SDKs, like other build artifacts, are stored in binary artifact repositories so later pipeline stages can retrieve them reliably.

Finally, the chapter moves into the deploy-and-test stage, where API gateway configuration is treated as code and promoted through environments using GitOps and APIOps practices. It contrasts push-based and pull-based deployment models, emphasizing declarative configuration, versioned history, automated reconciliation, and the reduction of manual gateway changes. Through examples with Kong and Kusk, the chapter shows how pipelines can deploy backend services, apply gateway routing, run conformance tests, and label verified API definitions in the registry. Overall, it presents a full workflow for publishing, simulating, packaging, deploying, and validating APIs as part of an automated delivery process.

The APIOps practices discussed in this chapter
figure
Example of API definition transformation in the pipeline
figure
API simulations provide an alternative to the real API to support development and testing.
figure
Updating the pipeline to generate an SDK
figure
Deploying API configuration to different environments in the pipeline
figure
GitOps push-based deployments
figure
GitOps pull-based deployment model
figure
Managing multiple applications and environments using a pull-based GitOps model depicting the configuration for the different environments in one central configuration repository
figure

Summary

  • In the build phase of the deployment pipeline, the API definition files can be processed and transformed to prepare them for external publishing. This transformation can include filtering the OpenAPI API definition file, replacing values, sorting objects in the file, and so on.
  • Processed API definition files can be stored in an API registry so that they can be accessed by teams, applications, and systems downstream of the deployment pipeline. An API registry serves as a catalog of the organization’s APIs and should have an API to enable programmatic access to API definition artifacts.
  • A variety of libraries and code-generation services exist for generating SDKs from API definition files. Client API SDKs help provide a better developer experience for teams integrating with an API. SDK packages can be stored in a binary artifact repository.
  • An APIOps deployment workflow follows the GitOps practice of storing configuration declaratively in version control. Changes are made by PR, and a deployment pipeline or Kubernetes operator is used to sync the configuration with the API gateway instance.

FAQ

What is the purpose of transforming API definition files in the build stage?Transforming API definition files makes them suitable for publishing or downstream use. Common transformations include bundling multifile definitions, filtering out internal endpoints, removing unused components, sorting fields consistently, and converting formats so the artifact is ready for a developer portal, SDK generation, or other pipeline steps.
Why would a pipeline bundle an OpenAPI definition before publishing it?Bundling combines a multifile API definition into a single file. This simplifies publishing, makes the definition easier for tools to process, and provides a single artifact that can be filtered, validated, stored, or shared with other stages of the pipeline.
How are internal API endpoints excluded from the published API definition?Internal endpoints can be marked with an OpenAPI extension such as x-internal:true. The pipeline can then use filtering tools like openapi-filter to remove those objects so only externally intended endpoints are published.
Why are unused components removed from an OpenAPI file?Removing unused components keeps the API definition smaller, cleaner, and easier to maintain. It also reduces noise for consumers and helps ensure that only relevant schemas, parameters, responses, and other reusable elements remain in the published artifact.
What is an API artifact store, and why is it used?An API artifact store is a place to store generated API artifacts such as processed OpenAPI files, SDKs, or documentation. It allows downstream teams and pipeline stages to retrieve versioned artifacts reliably, instead of regenerating them each time.
Why publish API definitions to an API registry?An API registry acts as an API catalog where definitions can be uploaded, searched, versioned, and retrieved programmatically. It helps teams discover reusable schemas and components, supports runtime validation, and provides a central source of truth for API artifacts.
What are the benefits of generating SDKs from an OpenAPI definition?Generated SDKs improve developer experience by reducing manual client coding, hiding integration complexity, and helping consumers get started faster. They can also reduce support burden and make it easier for teams to use the API consistently across applications.
Why store generated SDKs in a binary artifact repository like GitHub Packages?Binary artifact repositories are designed to store generated packages and their metadata in a versioned, shareable way. This avoids storing binaries in source control, supports reuse by downstream teams, and helps with release management and traceability.
What is APIOps, and how does it apply to API gateway configuration?APIOps is the application of GitOps principles to API configuration. Instead of changing gateway settings manually, teams manage declarative configuration in version control, review it through pull requests, and let automation reconcile the gateway state with the desired state.
How do build and deploy stages work together when deploying API gateway configuration?In the build stage, the pipeline prepares artifacts such as the API definition and SDKs. In the deploy and test stage, it deploys the backend service, applies the gateway configuration, runs conformance tests, and can label the API definition as having passed those tests before promotion or publishing.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Automating API Delivery Automating API Delivery ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Automating API Delivery Automating API Delivery ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Automating API Delivery Automating API Delivery ebook for free