Jenkins Basics & CI/CD Concepts
July 18, 2025
The mental model for Jenkins, plus the short answers I'd give in a viva.
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, exam-friendly): starts with
pipeline { ... }with a fixed structure —agent,stages,steps,post. Use this. - Scripted (older): full Groovy, starts with
node { ... }. More flexible, harder — just mention it exists.
Viva questions & short answers
- 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-task3-pipeline]], and the [[docker-basics]] set.