Chapter 01Lesson 01~95 minutes

Jenkins and CI/CD Foundations, Controller-Agent Architecture, Jobs, Builds, and Automation Boundaries: Concepts, Architecture, and Mental Model

Jenkins becomes predictable when you treat it as a distributed automation system rather than a web page that “runs builds.” The controller stores configuration and schedules work; a queue expresses pending intent; an eligible agent supplies an executor and workspace; Pipeline or job steps perform work; and logs, reports, artifacts, and external systems each record different evidence. This lesson builds that state model before introducing more syntax.

FoundationsController & agentBuild identityEvidenceLeast privilege

Learning objectives

  • Explain the controller → job → queue → agent/executor/workspace → build evidence chain without collapsing different states into “the build ran.”
  • Distinguish Jenkins core/controller state, item configuration, build records, agent state, workspace state, archived evidence, and external target state.
  • Use build number, URL, cause, source revision, node name, labels, executor/workspace, logs, and artifacts as an evidence chain.
  • Explain why routine builds should not run on the built-in controller node and why an online agent can still be ineligible for a queued job.
  • Relate Jenkins automation to CI, continuous delivery, deployment, least privilege, reproducibility, and operational ownership boundaries.

1. The practical problem: “Jenkins ran it” is not an explanation

Jenkins is often introduced with a short recipe: install the server, create a job, click Build Now, and read the console. That is enough to produce a first green icon, but it is not enough to operate Jenkins safely. When a production build is delayed or wrong, engineers need to answer much more precise questions: Which item was configured? What caused this particular run? Did the request enter the queue? Which label expression was evaluated? Which node accepted the work? Which executor and workspace were used? Which source revision was built? Which files were archived? Did an external deployment actually become healthy?

Those questions belong to different layers. A build can be queued but never allocated. An agent can be online but have the wrong labels. A shell step can return zero while the expected report is never published. An artifact can be archived correctly while a later deployment points at a different image digest. Jenkins is useful precisely because it coordinates these layers, but that coordination is reliable only when you preserve the identities that connect them.

Chapter 01 rule: every green indicator proves only its own state. A successful Jenkins build proves that Jenkins reached a successful build result according to the executed job/Pipeline. It does not automatically prove that the correct immutable source was used, that an external deployment is healthy, or that a downstream consumer received the intended artifact.

2. The controller-agent mental model

Start with intent. A user, schedule, webhook, SCM poll, API call, or upstream job causes Jenkins to consider an item for execution. The controller owns the item definition and the scheduling decision. If the work needs an executor, Jenkins creates a queue item and looks for a node whose labels, availability, executor capacity, and other constraints match. The selected agent provides the process environment and workspace in which build steps run.

Causal execution chain — follow state, not just color
flowchart TD
  A[User, SCM, timer, webhook, API, or upstream cause] --> B[Controller + item/job configuration]
  B --> C[Queue item]
  C --> D[Label / node eligibility]
  D --> E[Executor allocation on an agent]
  E --> F[Workspace + source + toolchain]
  F --> G[Pipeline or job steps]
  G --> H[Build result + logs + reports + artifacts]
  H --> I[External publication / deployment / notification]
  I --> J[Target health + retained operational evidence]

The diagram is deliberately vertical. Each arrow is a checkpoint. If a build is waiting, do not jump straight to the shell command. If the queue says no node matches linux && lab, the script has not started yet. If the console says an API returned HTTP 202, the external service may only have accepted a request. Diagnosis improves when you ask, “At which boundary did the expected state stop advancing?”

3. Core objects and the evidence they own

Object What it is Evidence to preserve
Controller The Jenkins process that stores system/item state, coordinates queueing, and serves the UI/API. Core/LTS version, Java runtime, controller URL/identity, relevant plugin versions, controller logs.
Item / job A configured automation object such as a Pipeline or Freestyle project. Full item path/name, configuration source, Jenkinsfile path/revision, parameters/triggers.
Queue item Pending execution intent waiting for eligibility/capacity. Queue ID, why it is waiting, requested label, originating item/cause.
Build / run One execution record of an item. Build number, URL, cause, result, start/end time, source revision.
Node / agent Execution resource known to Jenkins; the agent process performs work for the controller. Node name, labels, online/offline cause, Remoting/Java version, OS/architecture.
Executor A concurrency slot on a node. Node, executor count, occupied/idle state, queue wait.
Workspace Per-job execution directory on a node. Path, checked-out SHA, transient files; never treat it as durable release storage.
Artifact / report Evidence intentionally retained from a build. Producer job/build/SHA, file/digest, report ingestion status, retention.
External target SCM, registry, server, cluster, cloud service, chat system, or other system changed outside Jenkins. Provider-side object/deployment ID, immutable digest/version, health/status, external logs.

4. Controller state is not agent state, and workspace state is not evidence

The controller and agent are cooperating processes with different trust and persistence properties. The controller owns scheduling and long-lived Jenkins metadata. The agent is where build-controlled commands usually execute. A workspace is local execution state: it can be wiped, reused, deleted with an ephemeral agent, or changed by a later build. Therefore a file existing in $WORKSPACE is not the same as a file being archived, published, signed, or deployed.

This distinction also explains the current controller-isolation guidance. A build on the built-in node executes in the controller process environment and can reach the controller filesystem with the Jenkins process' privileges. That couples untrusted or merely buggy build logic to the most important state in the system. Modern operating practice sets built-in-node executors to zero after a separate agent path is available.

Trust boundary: “agent” does not automatically mean “safe sandbox.” A shared static agent can retain workspaces, tools, caches, and credentials between builds. Containerized or ephemeral agents improve disposability, but privileged containers, host mounts, Docker sockets, or broad Kubernetes permissions can collapse the isolation boundary.

5. Build identity: names move, build records should not

A branch such as main is a moving reference. A Jenkins build number is stable only within its job. A useful evidence record therefore joins several identities: full job name, build number/URL, build cause, exact SCM SHA, Jenkinsfile/library revision when applicable, and execution node/workspace. If a release is produced, add the artifact digest and external repository identity.

pipeline {
  agent { label 'lab' }
  stages {
    stage('Observe identity') {
      steps {
        sh '''
          set -eu
          printf 'job=%s\n' "$JOB_NAME"
          printf 'build=%s\n' "$BUILD_NUMBER"
          printf 'build_url=%s\n' "$BUILD_URL"
          printf 'node=%s\n' "$NODE_NAME"
          printf 'workspace=%s\n' "$WORKSPACE"
        '''
      }
    }
  }
}

The environment variables above identify Jenkins-owned execution state. They do not, by themselves, prove which source commit was checked out. When the job uses SCM, record git rev-parse HEAD (or the equivalent SCM identifier) from the workspace and compare it with the expected revision.

6. A build cause explains why Jenkins scheduled the run

Jenkins records causes such as a user starting a build, a timer firing, an SCM poll detecting a change, an upstream build completing, or an API/remote trigger. The cause answers “why did this run exist?” It is separate from the source revision and separate from the eventual result.

In the UI, inspect the build overview and console header before rerunning. In later automation chapters you can query causes through supported Pipeline/API mechanisms, but Chapter 01 deliberately starts with read-only inspection so the learner sees the records Jenkins already preserves.

Job identity

Record the full item path, not only a display label.

Build identity

Record build number and URL before retrying or deleting.

Cause

Record whether a user, SCM, timer, API, or upstream relation created the run.

Source

Record the immutable commit SHA actually present in the build workspace.

Execution

Record node name, labels, executor context, workspace, Java/tool versions.

Outputs

Record report ingestion and artifact digest/retention separately from workspace files.

7. Jenkins automation, CI, continuous delivery, and deployment are related—not synonyms

Practice What Jenkins may coordinate What a green build still does not prove
Automation Repeatable execution of a task based on an item definition. That the task is part of a sound CI/CD design or used the intended source.
Continuous integration Frequent validation of integrated changes through builds/tests/analysis. That an artifact is releasable, approved, or deployed.
Continuous delivery Automation that keeps a verified change in a releasable state and can promote it under policy. That production deployment occurred.
Continuous deployment A policy/process that automatically deploys qualifying changes. That the external target is healthy after rollout.
External orchestration Jenkins calls registries, cloud APIs, clusters, scanners, or notification systems. That the external system completed asynchronous work successfully.

8. Read-only inspection before changing anything

When you inherit a Jenkins environment, start by observing. On a disposable lab controller, the same habit prevents “fixes” from destroying useful evidence. Record the controller version and Java runtime, then inspect the item, its recent builds, queue, and node list. Do not start with a restart, plugin upgrade, workspace wipe, or rerun.

# Controller image version without creating persistent state
docker run --rm jenkins/jenkins:2.568.3-lts-jdk21 --version

# After the lab controller is running
docker logs --tail 80 jenkins-ch01-controller

docker exec jenkins-ch01-controller java -version

Inside a build, print only non-secret fields needed for evidence. Do not dump the full environment: Jenkins environment variables can contain credentials or security-relevant values in later chapters.

9. Security and performance begin with scheduling boundaries

Current Jenkins guidance advises moving normal builds off the built-in node. This is both a security and an availability decision: build scripts should not compete with the controller for the same filesystem and process privileges, and build CPU/heap pressure should not destabilize scheduling and the UI. It also makes the ownership boundary visible: controller problems and agent problems can be diagnosed independently.

Executor count is capacity, not a “make it faster” slider. Increasing executors on an agent can increase contention for CPU, memory, disk, network, Docker daemon capacity, or external rate limits. Chapter 01 therefore uses a single-executor disposable agent so queue and allocation behavior are easy to observe.

10. Common beginner misconceptions

Misconception Why it fails Better mental model
“The controller is the build machine.” It couples build-controlled commands to controller state and resources. Controller schedules; agents execute routine workloads.
“Online agent means my job can run.” Labels, executor count, temporary offline state, and constraints still matter. Online is only one eligibility condition.
“Green means deployment is healthy.” Jenkins may only know a command/API request returned success. Verify provider-side deployment/health independently.
“The branch name identifies the build.” Branches move after the run. Preserve the exact source SHA plus job/build identity.
“The workspace is my artifact store.” Workspaces are mutable execution state. Archive/publish intended evidence and attach immutable identity.

11. Summary: model Jenkins as a chain of independently verifiable states

A Jenkins operating model becomes much easier to reason about once the controller, queue, agent, executor, workspace, build record, artifacts, and external systems are treated as separate layers. The evidence chain for a useful build is: controller/core/Java/plugin baseline → exact item → build cause/number → source revision → queue decision → node/label/executor/workspace → executed steps → reports/artifacts → external side effect → target health.

Lesson 2 turns this model into a disposable local lab and deliberately captures each identity before adding more Jenkins features.

Next lesson

Guided Hands-On Workflow and Core Operations

Create the disposable Jenkins controller/agent lab and capture the controller → queue → agent → build → artifact evidence chain.

Knowledge check

A build is green and the deploy script printed “request accepted.” What is proved?

Why should a routine build not run on the built-in node?

An agent is online, but a job remains queued. Name two possible reasons.

Which identity is stronger for reproducing source: branch main or a commit SHA?

A file exists in $WORKSPACE. Is it durable build evidence?

Official references and version notes

Version and compatibility note

Rechecked against primary Jenkins sources on 2026-09-13. The executable Chapter 01 baseline is 2.568.3 LTS on Java 21 (Java 25 is also supported by this LTS line), controller image jenkins/jenkins:2.568.3-lts-jdk21, and inbound-agent image jenkins/inbound-agent:3391.va_37fa_a_305d6d-2-jdk21. The current LTS line can change after this date, so future generation and later lab reuse must re-check the LTS changelog, Java support matrix, Docker tags, plugin minimum core versions, and security advisories.

Keep the academy open

Support free, practical DevOps education.

Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.

Ethereum / ERC-20
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this address.