Jenkins Guide & Reference
This Jenkins guide provides a complete reference — covering installation, configuration, core concepts and hands-on CI/CD Pipeline examples for developers and DevOps engineers looking to automate their delivery workflows.
1. Core Concepts
- Master & Agents: Jenkins can distribute builds across multiple nodes for scalability.
- Pipeline: A sequence of automated steps defined as code to build, test and deploy software.
- Plugins: Extend Jenkins functionality (e.g., GitHub, Docker, Kubernetes, Slack).
- Declarative vs Scripted: Two syntaxes for defining Jenkins pipelines.
- Artifacts & Workspace: Temporary build data and output files generated during jobs.
2. Declarative Pipeline Example
pipeline {
agent any
environment {
DOCKER_IMAGE = "myapp:latest"
}
stages {
stage('Checkout') {
steps {
git branch: 'main', url: 'https://github.com/stackcouture/sample-app.git'
}
}
stage('Build') {
steps {
sh 'docker build -t $DOCKER_IMAGE .'
}
}
stage('Test') {
steps {
sh 'npm test'
}
}
stage('Deploy') {
steps {
sh 'docker run -d -p 8080:80 $DOCKER_IMAGE'
}
}
}
post {
always {
echo 'Pipeline complete.'
}
}
}
3. Scripted Pipeline Example
node {
stage('Checkout') {
git 'https://github.com/stackcouture/sample-app.git'
}
stage('Build') {
sh 'mvn clean package'
}
stage('Test') {
sh 'mvn test'
}
stage('Deploy') {
sh 'scp target/app.jar ubuntu@server:/opt/app/'
}
stage('Notify') {
echo 'Build and deployment complete.'
}
}
4. CI/CD Integration Examples
- GitHub Webhooks: Trigger Jenkins builds automatically on push events.
- Docker Integration: Use Docker agents and publish containerized builds.
- Kubernetes: Deploy build agents dynamically using Jenkins Kubernetes plugin.
- Slack Notifications: Send build status updates to Slack channels.
5. Useful CLI & Admin Commands
- Restart Jenkins:
sudo systemctl restart jenkins - List installed plugins:
jenkins-cli.jar -s http://localhost:8080/ list-plugins - Run job via CLI:
jenkins-cli.jar -s http://localhost:8080/ build my-job - Backup config:
tar -czf jenkins_backup.tar.gz /var/lib/jenkins
Contact
I’m always excited to connect with professionals, recruiters and tech enthusiasts.
Whether you’d like to collaborate on DevOps initiatives, discuss cloud architecture,
or explore automation strategies — I’d be glad to hear from you.
I’m also actively exploring new job opportunities where I can contribute my skills
in DevOps, cloud engineering and automation to help teams build scalable and reliable systems.
Let’s build something impactful together!