What Jenkins Does
- Pipelines — Jenkinsfile (Groovy) declarative or scripted
- Freestyle jobs — GUI-configured legacy jobs
- Distributed builds — controller + agents on multiple machines
- Plugins — 2000+ for source control, build tools, deploy targets, notifications
- Multibranch — auto-discover branches and PRs
- Shared libraries — reusable Groovy libraries across pipelines
- Credentials store — encrypted secrets management
- Blue Ocean — modern pipeline UI
- CloudBees integrations — enterprise extensions
Architecture
Jenkins controller hosts the UI, scheduler, and job configuration. Agents (formerly slaves) execute builds in parallel, connected via JNLP, SSH, or Kubernetes pods. Pipelines are checkpointed — survive controller restarts.
Self-Hosting
# docker-compose.yml
version: "3"
services:
jenkins:
image: jenkins/jenkins:lts-jdk17
ports: ["8080:8080", "50000:50000"]
volumes:
- jenkins-data:/var/jenkins_home
environment:
JAVA_OPTS: "-Djenkins.install.runSetupWizard=false"
volumes:
jenkins-data:Key Features
- Pipeline-as-code (Jenkinsfile)
- 2000+ plugins
- Distributed builds
- Matrix builds
- Shared libraries
- Credentials store
- Email/Slack/Teams notifications
- Multi-branch pipelines
- Auto-scaling agents on Kubernetes
- LDAP, SAML, OAuth auth
Comparison
| CI/CD | Hosted | Pipeline | Ecosystem |
|---|---|---|---|
| Jenkins | Self-hosted | Jenkinsfile | Largest |
| GitHub Actions | Cloud + self-hosted runners | YAML | Huge |
| GitLab CI | Cloud + self-hosted | YAML | Large |
| CircleCI | Cloud + enterprise | YAML | Large |
| Drone | Self-hosted | YAML | Medium |
| Woodpecker | Self-hosted | YAML | Growing |
常见问题 FAQ
Q: Jenkins 是不是过时了? A: 被 GitHub Actions、GitLab CI 抢走了大量新项目。但 Jenkins 在企业(尤其是有存量 pipeline、严格合规要求)仍然是首选。2000+ plugin 无出其右。
Q: 和 GitHub Actions 比? A: Actions 云原生、YAML 简洁、与 GitHub 深度集成;Jenkins 自托管、Groovy 灵活、插件生态无敌。选择看托管偏好和集成需求。
Q: 性能和内存? A: Java 应用,controller 通常至少 2GB 堆。大规模部署(百万 job)需要调优 JVM 和存储。
来源与致谢 Sources
- Docs: https://www.jenkins.io/doc
- GitHub: https://github.com/jenkinsci/jenkins
- License: MIT