Lesson content
Read, practise, then check your understanding
Jobs and Pipelines
Freestyle jobs configure source, triggers, build steps, and post-build actions through the UI. They remain useful for small legacy tasks. Pipelines express multi-stage delivery in code, support review and reuse, and can resume around controller interruptions.
Core ideas
- A stage groups meaningful work such as Build, Verify, Package, or Deploy.
- A step performs one operation through Pipeline syntax or a plugin-provided command.
- A workspace contains the checked-out source and temporary build files on an agent.
- Artifacts are retained build outputs; stashes are temporary files intended for movement between stages in one run.
How it works
Prefer one pipeline per releasable component with fast validation early. Run independent work in parallel where resource use stays reasonable. Archive only necessary outputs, publish reports even after failures, and make deployments consume a specific immutable build result.
Configuration example
pipeline {
agent any
stages {
stage('Verify') {
parallel {
stage('Unit') { steps { sh 'npm test' } }
stage('Lint') { steps { sh 'npm run lint' } }
}
}
stage('Package') {
steps {
sh 'npm pack'
archiveArtifacts artifacts: '*.tgz', fingerprint: true
}
}
}
}
The sample is intentionally small. In a real installation, replace hostnames, labels, credentials, retention, and commands with reviewed values from your own platform standards.
Production guidance
- Use descriptive job and stage names so dashboards and notifications communicate intent.
- Set build retention to control disk use while preserving required audit evidence.
- Do not use one mutable workspace as the handoff between independent jobs. Use immutable artifacts.
The chapter quiz follows this lesson and tests both terminology and safe operating choices.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.