← All learning hubsCI/CD

Learn Jenkins

The battle-tested automation server powering CI/CD pipelines everywhere.

Overview

Jenkins is a widely-used open-source automation server for building, testing, and deploying software through continuous integration and continuous delivery pipelines. Pipelines are defined as code in a Jenkinsfile using Groovy-based declarative or scripted syntax, so the build process lives in version control alongside the app. Its large plugin ecosystem and distributed controller/agent architecture let it integrate with almost any toolchain and scale builds across many machines.

Learn in this order

Jenkins roadmap

  1. 1

    CI/CD fundamentals

    Understand continuous integration, delivery, and deployment before automating them.

  2. 2

    Jenkins architecture

    Controller vs. agents (nodes), executors, and how builds are distributed.

  3. 3

    Freestyle vs. Pipeline jobs

    Move from click-configured freestyle jobs to pipeline-as-code with a Jenkinsfile.

  4. 4

    Declarative pipelines

    Learn pipeline, agent, stages, steps, and post blocks in a Jenkinsfile.

  5. 5

    Triggers and SCM integration

    Poll SCM, webhooks, and multibranch pipelines that build every branch and PR.

  6. 6

    Credentials and security

    Store secrets in the credentials store and inject them safely into builds.

  7. 7

    Plugins and integrations

    Add Docker, Git, test reporters, and deployment plugins to extend Jenkins.

  8. 8

    Scaling and best practices

    Ephemeral agents (e.g. on Kubernetes), shared libraries, and pipeline optimization.

Get interview-ready

Top Jenkins interview questions

Real questions with concise, correct answers. Click to expand each.

What is the difference between a declarative and a scripted pipeline?+

Both are defined in a Jenkinsfile. A declarative pipeline uses a structured, opinionated syntax inside a 'pipeline { }' block with predefined sections (agent, stages, steps, post) — it's simpler and easier to validate. A scripted pipeline is full Groovy code inside a 'node { }' block, offering maximum flexibility and programmatic control at the cost of complexity. Most teams prefer declarative.

What is the Jenkins controller/agent architecture?+

The controller (formerly 'master') schedules jobs, stores configuration, and serves the UI, but ideally runs no builds itself. Agents (nodes) are separate machines that connect to the controller and execute the build steps in executors. This distributes load, isolates builds, and lets you run jobs on different platforms or ephemeral agents.

What is a Jenkinsfile and why keep it in source control?+

A Jenkinsfile is a text file that defines the pipeline as code. Keeping it in the repository means the build process is versioned alongside the application, reviewed via pull requests, auditable, and reproducible. It also enables multibranch pipelines, where Jenkins automatically discovers and builds each branch that contains a Jenkinsfile.

How do you handle secrets and credentials in Jenkins?+

Store them in the Jenkins Credentials store (or an external secrets manager) rather than in the Jenkinsfile. In a pipeline you inject them with the credentials() helper or a withCredentials block, which binds them to environment variables only for the duration of the step and masks them in the console log so they aren't exposed.

What is a multibranch pipeline?+

A multibranch pipeline automatically scans a repository, creates a pipeline job for every branch (and often every pull request) that contains a Jenkinsfile, and removes jobs when branches are deleted. This gives each branch its own CI without manual job setup and is central to trunk-based and feature-branch workflows.

What does the 'post' section in a declarative pipeline do?+

The post section defines steps that run after a stage or the whole pipeline finishes, based on the outcome. Conditions like always, success, failure, unstable, and changed let you send notifications, clean up workspaces, or archive artifacts regardless of — or depending on — whether the build passed.

Keep it handy

Jenkins cheat sheet

pipeline { }

Top-level block of a declarative Jenkinsfile.

agent any

Run the pipeline on any available agent.

stages { stage('Build') { } }

Group the work into named, visualized stages.

steps { sh 'make' }

Execute shell commands (or other steps) in a stage.

environment { }

Define environment variables for the pipeline or stage.

post { always { } }

Run steps after the build based on its result.

withCredentials([...])

Bind stored secrets to variables for a block.

when { branch 'main' }

Run a stage only when a condition is met.

Prove it

Jenkins certifications

Certified Jenkins Engineer (CJE)

CloudBees certification validating pipeline authoring, administration, and best practices.

CloudBees CI Platform certifications

Vendor tracks for administering and scaling Jenkins-based CI at the enterprise level.

Ready to ace the interview?

This hub gets you started. Our Jenkins interview kit goes deeper — hundreds of curated questions, model answers, and mock scenarios built to get you hired.

Keep learning