Jenkins
Jenkins is the most widely used open-source automation server. It enables building, testing, and deploying through plugins and pipeline-as-code with Jenkinsfile.
Jenkins Architecture
ββββββββββββββββ ββββββββββββββββ
β Jenkins ββββββΆβ Build β
β Master β β Agent 1 β
β ββββββΆβ Agent 2 β
β - Schedules β β Agent 3 β
β - Dashboard β β β
β - Config β β (Workers) β
ββββββββββββββββ ββββββββββββββββ
Master-Agent architecture for scalability
Jenkinsfile (Declarative Pipeline)
pipeline {
agent any
stages {
stage('Checkout') {
steps {
git 'https://github.com/user/app.git'
}
}
stage('Build') {
steps {
sh 'npm install'
sh 'npm run build'
}
}
stage('Test') {
steps {
sh 'npm test'
}
}
stage('Deploy') {
steps {
sh 'docker build -t myapp:latest .'
sh 'docker push myapp:latest'
sh 'kubectl apply -f k8s/'
}
}
}
post {
failure {
mail to: 'team@example.com',
subject: "Build Failed: ${currentBuild.fullDisplayName}"
}
}
}
Key Jenkins Concepts
- Pipeline β Automated workflow defined as code (Jenkinsfile)
- Stages β Logical divisions of the pipeline (Build, Test, Deploy)
- Steps β Individual tasks within a stage
- Agents β Machines that execute the pipeline
- Plugins β 1800+ plugins for integrations (GitHub, Docker, Slack, etc.)