Answer
What is Jenkins?
Jenkins is an open-source Continuous Integration / Continuous Delivery (CI/CD) automation server written in Java. It helps teams automatically build, test, and deploy code every time a developer pushes changes.
Why Jenkins?
CODE
Developer pushes code ā Git triggers Jenkins ā Jenkins:
1. Pulls latest code
2. Compiles (Maven/Gradle/npm)
3. Runs unit tests
4. Runs automation tests (Selenium/Cypress)
5. Builds artifact (JAR/Docker image)
6. Deploys to staging/production
7. Sends notification (email/Slack)
Key Features
- āFree & Open Source ā large plugin ecosystem (1800+ plugins)
- āPipeline as Code ā Jenkinsfile (Groovy DSL) stored in Git
- āDistributed Builds ā Master/Agent architecture for parallel execution
- āIntegration ā Git, GitHub, GitLab, Bitbucket, Maven, Docker, AWS, Kubernetes
- āPlugin Ecosystem ā Slack, SonarQube, JaCoCo, Allure Reports, etc.
- āScheduled Jobs ā run builds via cron syntax
- āParameterized Builds ā pass variables to jobs (environment, browser, etc.)
Jenkins Architecture
CODE
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Jenkins Master ā
ā - Schedules builds ā
ā - Monitors agents ā
ā - Manages plugins & config ā
ā ā ā
ā āāāāāāāāāāāāā¼āāāāāāāāāāāā ā
ā ā ā ā ā
ā Agent 1 Agent 2 Agent 3 ā
ā (Linux) (Windows) (Docker) ā
ā Run tests Run tests Build image ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Jenkins vs GitHub Actions
| Feature | Jenkins | GitHub Actions |
|---|---|---|
| Hosting | Self-hosted | Cloud (GitHub) |
| Cost | Free (self-host) | Free tier + paid |
| Setup | Complex | Simple (YAML) |
| Plugin eco | Huge (1800+) | Growing (marketplace) |
| Control | Full | Limited |
| Scaling | Manual agents | Auto-scaled runners |
Installation (Quick Start)
Bash
# Docker (easiest)
docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
# Access at http://localhost:8080
# Initial password: docker logs <container-id>
