DevOps
Jenkins
Jenkins is an open source automation server for CI/CD with a huge plugin ecosystem and pipelines as code.
What it is
Jenkins grew out of the Hudson project created by Kohsuke Kawaguchi and has been developed as Jenkins since 2011. It is one of the oldest and most widespread CI servers. It runs on Java, is installed on your own servers and managed through a web UI.
Pipelines are described in a Jenkinsfile (a Groovy-like language, declarative or scripted syntax). Builds run on agents (nodes), and functionality is extended with plugins: over a thousand, from Git and Docker to Kubernetes and Slack.
Jenkins' strength is flexibility and full control, its weakness is manual upkeep: you maintain updates, plugins and security yourself.
Use it when
- You need full control of CI on your own infrastructure.
- You have complex, non-standard pipelines or legacy integrations.
- Your company already has a large Jenkins estate.
Avoid it when
- You start a new project on GitHub or GitLab: built-in CI is simpler.
- You have no time to maintain the server, plugins and their updates.
Key concepts
- Jenkinsfile
- A pipeline described as code that lives in the repository next to the project.
- Controller / agent
- The controller manages pipelines, agents run builds on separate nodes.
- Plugin
- An extension that adds integrations and features to Jenkins.
- Declarative pipeline
- A structured pipeline syntax with stages and steps, simpler than scripted Groovy.
Example
Interview questions
1. What is a Jenkinsfile?
A file in the repository that describes the pipeline as code. It can be declarative (structured stages) or scripted (Groovy). The pipeline is versioned along with the code.
2. Why do we need agents?
The controller only coordinates, while agents run builds on separate machines or in containers. That spreads load and gives different build environments.
3. What are the main downsides of Jenkins?
It needs administration, depends on plugins of varying quality, and updates and security are on you. That is why new projects often pick the platform's built-in CI.
Related technologies
- GitHub ActionsGitHub Actions is CI/CD built into GitHub: YAML workflows run on repository events such as push or pull request.
- GitLab CI/CDGitLab CI/CD is the build and delivery system built into GitLab, configured with a .gitlab-ci.yml file.
- DockerDocker packages an application with its dependencies into a container that runs the same on a laptop, a server and the cloud.
- KubernetesKubernetes is a container orchestration system that deploys, scales and heals applications across a cluster of servers.
Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).