๐Ÿ’พThananjhayan
โ† Back to notes

Jenkins Basics & CI/CD Concepts

December 28, 2025

The mental model for Jenkins, plus short answers to the questions that come up most.

The concepts

  • Jenkins โ€” an open-source automation server for CI/CD (Continuous Integration / Continuous Delivery). It automatically builds, tests, and deploys code whenever triggered (manually, on a schedule, or on a git push).
  • CI (Continuous Integration) โ€” developers merge often; each change is automatically built and tested.
  • CD (Continuous Delivery/Deployment) โ€” the tested build is automatically released (e.g. image pushed to Docker Hub, app deployed).
  • Pipeline โ€” the whole automated workflow, written as code in a Jenkinsfile kept in your repo ("pipeline as code").
  • Node / Agent โ€” a machine (or container) where Jenkins runs the job.
  • Stage โ€” a logical phase of the pipeline (Checkout, Build, Test, Pushโ€ฆ).
  • Step โ€” a single command inside a stage (e.g. sh 'docker build ...').
  • Plugin โ€” an add-on that extends Jenkins (Git plugin, Docker plugin, etc.).

Declarative vs scripted pipeline

  • Declarative (newer, easier): starts with pipeline { ... } with a fixed structure โ€” agent, stages, steps, post. Use this.
  • Scripted (older): full Groovy, starts with node { ... }. More flexible, but more to get wrong.

Common questions

  • What is Jenkins / CI/CD? An automation server that builds, tests, and deploys code automatically. CI = auto build+test on each change; CD = auto release.
  • What is a Jenkinsfile? A text file in the repo defining the pipeline as code.
  • Declarative vs scripted? Declarative = simple fixed structure (pipeline{}); scripted = full Groovy (node{}).
  • Stage vs step? Stage = a phase (Build/Push); step = a single command.
  • What triggers a build? Manual (Build Now), scheduled (cron), or on git push (webhook / poll SCM).
  • Why use Jenkins with Docker? Automates build โ†’ push โ†’ deploy, so no manual steps; repeatable, consistent builds.

See also: [[jenkins-install]], [[jenkins-jenkinsfile-explained]], [[jenkins-3-stage-pipeline]], and the [[docker-basics]] set.

๐Ÿ’ฌ Comments