# Jenkins — The Original Open-Source Automation Server > Jenkins is the original and still widely-used open-source automation server for CI/CD. 2000+ plugins, pipeline-as-code via Jenkinsfile, distributed builds, and first-class support for nearly every build tool. The battle-tested choice for enterprise CI. ## Install Save as a script file and run: ## Quick Use ```bash # Docker docker run -d --name jenkins -p 8080:8080 -p 50000:50000 \ -v jenkins-data:/var/jenkins_home \ jenkins/jenkins:lts-jdk17 # Get initial admin password docker exec jenkins cat /var/jenkins_home/secrets/initialAdminPassword # Visit http://localhost:8080 and complete setup ``` Create a Jenkinsfile in your repo: ```groovy pipeline { agent any environment { NODE_VERSION = "20" } stages { stage("Checkout") { steps { checkout scm } } stage("Install") { steps { sh "npm ci" } } stage("Test") { steps { sh "npm test" } post { always { junit "test-results/*.xml" } } } stage("Build") { steps { sh "npm run build" } } stage("Deploy") { when { branch "main" } steps { sh "./deploy.sh production" } } } post { failure { slackSend channel: "#ci", message: "Build failed: ${env.BUILD_URL}" } } } ``` ## Intro Jenkins is the original open-source automation server. Created as Hudson in 2004 by Kohsuke Kawaguchi at Sun Microsystems, forked to Jenkins in 2011. Jenkins still powers a huge portion of the worldwide CI/CD workload, especially in enterprise environments thanks to its 2000+ plugin ecosystem and extreme customizability. - **Repo**: https://github.com/jenkinsci/jenkins - **Stars**: 25K+ - **Language**: Java - **License**: MIT ## 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 ```yaml # 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 --- Source: https://tokrepo.com/en/workflows/0114181b-35f7-11f1-9bc6-00163e2b0d79 Author: Script Depot