What is "pipeline as code", and why is it better than configuring pipelines in a UI?

BeginnerConceptCI/CD practices
Answer

In one line: Pipeline as code means defining your CI/CD pipeline in a file stored in the same Git repository as the app — such as a Jenkinsfile, .github/workflows/*.yml or .gitlab-ci.yml — instead of clicking through settings in a web UI.

Examples of pipeline-as-code files:

Tool File
Jenkins Jenkinsfile
GitHub Actions .github/workflows/ci.yml
GitLab CI .gitlab-ci.yml
Azure Pipelines azure-pipelines.yml
CircleCI .circleci/config.yml

Why it's better:

  1. Version control — every pipeline change has history: who changed it, when and why.
  2. Code review — pipeline changes go through pull requests like app code.
  3. Easy rollback — if a pipeline change breaks builds, revert the commit.
  4. Branch-specific pipelines — a feature branch can change its pipeline without affecting main.
  5. Reusable — share templates or shared libraries across many repos.
  6. Disaster recovery — if the CI server dies, the pipelines aren't lost; they're in Git.
  7. Self-documenting — anyone can read how the app is built and deployed.

Problems with UI-configured pipelines:

  • Nobody knows who changed a setting or why.
  • Hard to copy to new projects without mistakes.
  • Lost if the server is rebuilt without a backup.
  • Each project slowly becomes different ("snowflake pipelines").

Example:

# .github/workflows/ci.yml
name: ci
on: [pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make test

Tip for interviews: mention reusable templates (Jenkins shared libraries, GitHub reusable workflows, GitLab include) — at scale, that's how teams keep dozens of pipelines consistent.

All DevOps Fundamentals questions

More on CI/CD practices