What Is Pipeline as Code?
Pipeline as code means defining your CI/CD pipeline in version-controlled configuration files that live alongside your application code.
Early CI tools were configured by clicking through a web UI, which made pipelines hard to review, copy, or recover. Pipeline as code moves that configuration into files in your repository, so the pipeline is treated like any other code.
The core idea
Instead of configuring jobs in a dashboard, you write the pipeline definition in a file, often YAML, and commit it to your repository. The CI system reads that file to know what to run. The pipeline becomes part of the codebase, versioned and reviewed alongside the application.
An example
name: CI
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make build
- run: make testHow it works in practice
When the file changes, the pipeline changes, in the same commit, reviewed in the same pull request. You can see exactly who changed the build process and why. Branching the repository branches the pipeline too, so a feature branch can test pipeline changes safely before they reach the main line.
Why it beats a UI
- Version control: every pipeline change is tracked and reviewable.
- Reproducibility: the pipeline travels with the code, including history.
- Reuse: templates and shared files cut duplication.
- Recovery: restoring the repo restores the pipeline.
Why it matters
Pipeline as code brings software engineering discipline, review, testing, version history, to the delivery process itself. It also makes the pipeline portable and self-documenting: a new engineer can read the file and understand exactly how the project is built and shipped.
Key takeaways
- Pipeline as code defines CI/CD in version-controlled files.
- Pipeline changes are reviewed and tracked like application code.
- It improves reproducibility, reuse, and recoverability.