Master Jenkins: From Setup to CI/CD Pipelines and User Management
This comprehensive guide walks you through Jenkins' history, installation, configuration, plugin management, user permissions, parameterized builds, pipeline scripting, and email notifications, providing step‑by‑step commands, code snippets, and troubleshooting tips for setting up a robust CI/CD environment on Linux.
Jenkins from abandonment to beginner: deployment, configuration and application
Jenkins Overview
Jenkins originated from Hudson, an open‑source Java CI tool started by Sun in 2004. After a trademark dispute in 2011 the project was renamed Jenkins, which has since become the leading CI platform.
Why Jenkins is popular
Developer‑driven, active community
Open governance with independent board
Long‑term support releases ensure stability
Extensive plugin ecosystem (>1000 plugins)
Core Features
Continuous Integration / Continuous Delivery (CI/CD) automation
Build automation (Maven, Gradle, Ant, shell scripts)
Test automation (JUnit, TestNG, etc.)
Deployment automation (Docker, Kubernetes)
Monitoring and detailed reporting
Installation
Steps to install Jenkins on a RHEL‑based host:
# Install Git
yum install -y git
# Install JDK 17
yum install fontconfig java-17-openjdk -y
wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.rpm
yum -y install ./jdk-17_linux-x64_bin.rpm
# Add Jenkins repository and import key
wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat/jenkins.repo
rpm --import https://pkg.jenkins.io/redhat/jenkins.io-2023.key
# Install Jenkins
yum install jenkins -y
systemctl enable jenkins
systemctl start jenkinsConfiguration files
Key files used by Jenkins:
/usr/lib/systemd/system/jenkins.service – systemd unit definition
/usr/share/java/jenkins.war – web application archive
/var/lib/jenkins – Jenkins home directory (workspace, plugins, etc.)
Initial admin password
cat /var/lib/jenkins/secrets/initialAdminPasswordUser Management
Install the “Role‑Based Authorization Strategy” and “Authorize Project” plugins to define global, project, and agent roles. Manage roles via Manage Jenkins → Manage Users , assign roles to users, and control permissions such as read, build, and configure.
Parameterized Builds
Install the “Extended Choice Parameter” and “Git Parameter” plugins to enable branch selection and custom parameters in jobs, allowing more flexible and interactive builds.
Pipeline Example
pipeline {
agent any
parameters {
string(name: 'version', defaultValue: '2.0.0', description: 'Select version')
gitParameter(name: 'BRANCH', type: 'PT_BRANCH', defaultValue: 'master', branchFilter: 'origin/(.*)')
}
stages {
stage('pull code') {
steps {
cleanWs()
git branch: "${params.BRANCH}", credentialsId: 'xxxx', url: 'xxxx'
}
}
stage('build') {
steps {
sh "mvn clean install -DskipTests"
}
}
// Additional stages for Docker image build and push can be added here
}
}Email Notifications
Install the “Email Extension Plugin”, configure SMTP settings under Manage Jenkins → Configure System , and use the plugin in post‑build actions to send build status emails to stakeholders.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
