Hey, let's see how to set up jenkins, configure various tools, build a declarative pipeline out of them.
Jenkins is an open source CI/CD tool with good plugin integration
To run an end-to-end CI/CD pipeline, one should set up other tools like Maven, Sonarqube, Nexus, Apache Tomcat. Checkout my repositories, I've explained how to install and configure them efficiently.
sudo apt update
sudo apt install default-jre
java -version
Install jenkins from Source
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
jenkins -version
To enable the Jenkins service to start
sudo systemctl enable jenkins
To start the Jenkins service
sudo systemctl start jenkins
To check the status whether its running
sudo systemctl status jenkins
It runs on port 8080, enable it in the traffic rules
Initially, install the suggested plugins
Setup new username, password, Done.
This is how the home page looks like:
This is the 'Manage Jenkins', tab where we edit, configure, install tools, etc
The required plugins can be downloaded and confgured in global tools configuration
-
Source code repository: GitHub
-
Maven - Installed locally
-
SonarQube
-
Nexus Repo
-
Tomcat
-
Jenkins
First up, configure Maven in jenkins' global tools
To integrate sonarqube with jenkins, download the Sonarqube Scanner Plugin, install, configure it in global tools
For privacy, generate a security token from sonarqube, configure it in jenkins credentials
Configure the Sonar server
For the build, download Nexus artifact plugin
For Tomcat deployement, use ssh-agent
plugin which acts as a median between two machines
Makesure to use pipeline syntax feature everytime to generate a declarative pipeline.