Lesson content
Read, practise, then check your understanding
Best Practices and Optimization
Reliable Jenkins combines pipeline engineering with platform operations. Optimize feedback time without weakening correctness, centralize only stable shared behavior, and design the controller and agents so failure can be detected and recovered.
Core ideas
- Configuration as Code makes controller configuration reviewable and reproducible.
- Shared Libraries reduce duplication when they expose small versioned interfaces with owners and tests.
- Build retention, external artifact storage, workspace cleanup, and cache policy control disk pressure.
- Metrics and logs reveal queue delay, executor saturation, failure rate, controller health, and plugin problems.
How it works
Measure the critical path before parallelizing. Keep checkout and dependency setup efficient, fail fast on cheap checks, then run expensive integration work. Scale agents for execution load rather than adding controller executors. Schedule maintenance and verify backups through restoration drills.
Configuration example
@Library('delivery-library@v3') _
pipeline {
agent { label 'linux' }
options {
disableConcurrentBuilds(abortPrevious: true)
timeout(time: 30, unit: 'MINUTES')
}
stages {
stage('Deliver') {
steps { standardDelivery service: 'billing-api' }
}
}
}
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
- Version shared libraries and avoid changes that silently alter every consumer.
- Make builds deterministic, idempotent, cancellable, and independent of manual workspace state.
- Define service objectives for availability and queue time, then rehearse controller and credential recovery.
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.