CI/CD & Deployment interview question · Most asked

What is pipeline as code and why does it matter?

Definition Asked in DevOps Engineer · Site Reliability Engineer (SRE) · QA Engineer / SDET interviews

Members can save this page, take notes and track progress. See membership · Sign in

Summary

Pipeline as code means defining your CI/CD pipeline in a version-controlled file (Jenkinsfile, .github/workflows/*.yml, .gitlab-ci.yml) rather than configuring it through a web UI. Changes to the pipeline are reviewed, tested and audited like application code.

Longer Answer

Before pipeline as code, CI/CD configurations lived in a web UI (Jenkins job config, TeamCity settings). Changes were untracked — you couldn't tell who changed the deploy step, when, or why. Rolling back a broken pipeline meant recreating it from memory.

Benefits:

  1. Version control: every pipeline change is a commit with a message, an author and a diff. git blame tells you why the test step was changed last Tuesday.
  2. Code review: pipeline changes go through pull requests. A reviewer can catch a missing approval gate or an insecure secret reference before it reaches production.
  3. Reproducibility: the pipeline definition travels with the code. Checking out an old branch gives you the pipeline that existed at that time.
  4. Branch-specific pipelines: a feature branch can modify its own pipeline (add a new test suite, change a deploy target) without affecting other branches.
  5. Disaster recovery: if the CI server is lost, the pipeline definition is in Git. Set up a new server and point it at the repository.

Common formats:

  • GitHub Actions: .github/workflows/*.yml — event-driven, marketplace actions.
  • GitLab CI: .gitlab-ci.yml — stages and jobs, integrated with GitLab.
  • Jenkins: Jenkinsfile — declarative or scripted Groovy, shared libraries.
  • Azure Pipelines: azure-pipelines.yml — stages, jobs, templates.
  • CircleCI: .circleci/config.yml — orbs for reusable components.

Best practice: treat the pipeline file with the same rigour as application code. Lint it, template shared patterns (reusable workflows in GitHub Actions, includes in GitLab CI), and test changes on a branch before merging.

Key Points

  • Pipeline definitions live in version control alongside the application code
  • Changes are reviewed, audited and can be rolled back like any other code change
  • Branch-specific pipelines let feature branches modify their own CI without affecting others
  • If the CI server is lost, the pipeline is recoverable from Git

Explanation

What interviewers look for

Look for understanding of why UI-configured pipelines are problematic (untracked, unreviewable, unreproducible). Weak answers just name the file format. Strong answers explain the operational benefits: review, audit trail, disaster recovery.

More CI/CD & Deployment questions

← All CI/CD & Deployment questions

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake