Jobs, Builds, Queues, and Workspaces
Scenario: Deleting a workspace is mistaken for deleting build history, revealing confusion between scratch space and durable records.
Pipeline example
pipeline { agent any; stages { stage('Context') { steps { echo "${env.JOB_NAME} #${env.BUILD_NUMBER}" } } } }
Four Jenkins identities
A job is durable configuration: Pipeline definition, triggers, parameters, permissions, and retention. A queue item is a request waiting for an eligible executor. A build is one numbered execution with causes, inputs, result, log, and actions. A workspace is mutable scratch space allocated on an agent. Deleting a workspace removes files but not build history; deleting an old build removes evidence but does not clean every agent.
Workspace paths can be reused, and concurrent runs may receive suffixed directories. Never use a path as artifact identity or assume a previous checkout remains correct. Clean workspaces improve reproducibility at the cost of downloads. Maintain dependency caches deliberately outside deliverables and key them by compatible tool and lockfile versions. Use disableConcurrentBuilds when two executions would mutate the same target, or redesign the operation for isolation and idempotence.
Read scheduling evidence
For a run that appears stuck, determine whether it is queued or executing. Queue reasons identify missing labels, offline nodes, exhausted executors, throttles, or concurrency locks. Once allocated, record node name, workspace, revision, and cause. Separate queue duration from stage duration: a growing queue with short executions suggests capacity or label mismatch; long stages on otherwise idle agents point toward serial work or external latency.
Retention must preserve enough numbered builds, test trends, fingerprints, and logs for diagnosis while bounding controller storage. Workspace cleanup and history disposal solve different problems. Before deleting either, locate the last good build, failing revision, reports, archived outputs, and downstream consumers. A reliable job can start in an empty workspace and still explain precisely which source and inputs produced build number 417.
Goal: Practice the concrete behavior in jenkins-artifact-promotion. Learn sections have no Jenkins terminal; the Jenkins lab opens the real shared service in a new full-screen tab inside your private folder.