What Jenkins is and why it is still everywhere
Jenkins is an open source automation server, written in Java and extended through plugins. It schedules jobs, runs them on agents, and reports results. Since pipelines can be written in a Jenkinsfile, it can express almost any build and release process. That flexibility, together with years of accumulated plugins, is why so many organisations still run it.
It is also why Jenkins estates become fragile. A controller edited through the web interface, a long list of plugins nobody has reviewed, agents with hand-installed tools, and credentials scattered across job configurations. Our Jenkins consulting work focuses on turning that into something rebuildable and secure, and on being honest about when the right answer is to leave.
How we run Jenkins in production
Controller as code
The controller should be reproducible. We define configuration with the Configuration as Code plugin, pin plugin versions in a manifest, build the controller image from that, and store it all in git. A rebuilt controller then comes up with the same security realm, roles, clouds and global settings, and a plugin upgrade is a reviewed change tested in staging first.
Ephemeral agents on Kubernetes
The controller schedules; it does not build. Builds run on agents, and the cleanest model is a fresh pod per build with the tools that job needs.
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: build
image: registry.example.com/ci/node-build:22
command: ["sleep"]
args: ["infinity"]
resources:
requests: { cpu: "500m", memory: "1Gi" }
limits: { memory: "2Gi" }
'''
}
}
options { timeout(time: 30, unit: 'MINUTES') }
stages {
stage('Test') {
steps { container('build') { sh 'npm ci && npm test' } }
}
}
}
Build images are versioned and scanned like any other image. Timeouts stop stuck jobs from holding capacity. If you do not yet run a cluster for this, our Kubernetes consulting team can size a build pool, or we can use autoscaled cloud instances instead.
Shared libraries
Repeated steps such as build, scan, publish and deploy belong in a shared library, versioned by tag. Application Jenkinsfiles then shrink to a few lines. This is the Jenkins equivalent of the patterns in reusable workflows and pipeline as code.
Pipelines that fail fast and recover cleanly
A Jenkinsfile should do the cheap checks first, set timeouts on every stage, archive only the artefacts you need and clean its workspace. We add retry only around genuinely flaky external calls, never around tests, because retrying tests hides instability. Post-build handlers send notifications and always release locks or cloud resources. These small habits keep agents available, and keep failures visible rather than silently masked, which matters more on a shared controller than any single plugin choice.
Security and access
Jenkins has a long public record of plugin vulnerabilities, so patch discipline matters more here than on a hosted platform.
- Keep core and plugins current, and remove plugins you do not use.
- Use your identity provider for authentication and role-based or matrix authorisation instead of shared accounts.
- Run zero executors on the controller so build code cannot touch it.
- Keep secrets in the credentials store or an external manager, never in job parameters or scripts. See CI/CD secrets management with Vault.
- Treat the script approval queue as a security control. Approve narrowly and review what is approved.
- Do not expose the controller to the public internet. Put it behind a VPN or an authenticating proxy.
Cost and capacity
Jenkins itself is free, but the real costs are people and infrastructure. Idle long-lived agents are the usual waste. Ephemeral agents that scale to zero convert that into pay-per-build. The hidden cost is maintenance time: upgrades, plugin compatibility and the engineer who understands the oldest jobs. When we compare Jenkins with hosted CI for a client, we count that time, because it often outweighs infrastructure savings.
Day-2 operations
- Backups: back up the controller home or, better, rely on configuration as code plus a backup of build history you actually need. Test a restore.
- Upgrades: monthly in staging, then production, with a rollback image ready.
- Monitoring: expose metrics and watch queue length, agent provisioning time and failure rates through Prometheus and Grafana.
- Hygiene: discard old builds, delete unused jobs and rotate credentials on a schedule.
Failure modes we see most
| Symptom | Likely cause | Our approach |
|---|---|---|
| Controller slow or crashing | Builds on the controller, huge history | Zero executors, retention limits |
| Upgrade breaks jobs | Unpinned or abandoned plugins | Staging clone, pinned manifest |
| Builds differ between agents | Hand-installed tools | Container-based agents |
| Credential leak | Secrets in job config or logs | Credentials store, masking, rotation |
| Nobody knows what a job does | Freestyle jobs configured in the UI | Jenkinsfiles in git |
When to move off Jenkins
Leave if you spend more effort keeping Jenkins alive than shipping software, if your team cannot staff its upkeep, or if your code already lives on a platform with built-in CI. GitHub Actions and GitLab CI/CD are the common destinations, and Azure Pipelines fits Azure DevOps users. Stay if you need full control in an isolated network or have deeply customised workflows that would be costly to rewrite.
Our approach to moving is in the Jenkins to Actions migration plan and the migration guide on our blog. Start with a conversation through our CI/CD pipeline service or contact us.
Official documentation: www.jenkins.io/doc