Sonarqube Intro & Setup With Jenkins
Sonarqube Intro & Setup With Jenkins
Sonarqube Intro & Setup With Jenkins
whats is SonarQube
why static code analysis in the list
customize the rules
static code analysis tools is in market list
sonar supports programming list
code quality checks: potentials, rewritten code, excess complexity
its integration with CICD etc. Jenkins
components of SonarQube-
server & scanner
SonarQube best practices - bugs -
SonarQube setup with Jenkins is one time for Devops engineer
Developer & access to developer
Database for SonarQube supported:
What is SonarQube?
SonarQube is an open-source tool for managing the code quality of an application. It
manages seven axes of code quality, such as architecture and design, duplications, unit
tests, potential bugs, complexities, coding rules, and comments.
WHY is SonarQube?
SonarQube is the leading tool for continuously inspecting the Code Quality and Security of
your codebases, and guiding development teams during Code Reviews. Covering 27
programming languages, while pairing-up with your existing software pipeline, SonarQube
provides clear remediation guidance for developers to understand and fix issues, and for
teams overall to deliver better and safer software. With over 225,000 deployments helping
small development teams as well as global organizations, SonarQube provides the means
for all teams and companies around the world to own and impact their Code Quality and
Security.
1. Importance of Static Code Analysis:
Explore why static code analysis is crucial in the development process.
Identify and fix issues early in the development lifecycle.
Enhance code maintainability and readability.
Ensure adherence to coding standards.
2. Customizing Rules in SonarQube:
CLOUD ASEEM cloud aseem - YouTube
Learn how to tailor SonarQube's rules to fit your project's specific needs.
Explore customization options for coding standards, security, and other
aspects.
3. Static Code Analysis Tools:
Static Code Analysis Tools are used to automatically analyze source code without
executing the program. They help developers understand their code base and ensure
that it is compliant, safe, and secure1. These tools can identify potential
vulnerabilities and weaknesses in the source code1.
LABS
Installation steps in aws machine:
Download Sonar from http://www.sonarqube.org/downloads/
newgrp docker
docker ps
After the docker installation, we will create a Sonarqube container (Remember to add 9000
ports in the security group).
https://www.sonarsource.com/products/sonarqube/downloads/success-download-community-
edition/
Once Sonar server is up and Running use url to access sonar server dash board.
http://IP:9000/ or http://<ip_addr>:9000/
1. Login the sonar dash board using default username and password. The default
username and password is admin/admin.
login : admin
sonarqube – aseemadmin
sqa_abed585d20e9b8bfb0ae576c4672c47fb40d371c
sonar proporties
sonar.projectKey=website
CLOUD ASEEM cloud aseem - YouTube
jenkins file
node {
stage('SCM') {
checkout scm
stage('SonarQube Analysis') {
withSonarQubeEnv() {
sh "${scannerHome}/bin/sonar-scanner"
sqa_85e34a489106004670a610a3a6c5623ac002dd98
sonarqube - itsadmin
1. If we want to integrate with Jenkins, we need to create security token trough sonar
dash board. Goto administration MyAccount Security enter the name of the
token Generate the token.
CLOUD ASEEM cloud aseem - YouTube
Check the updated token list goto Administration select security Users.
1. Once we can security token with handy now, we can integrate with Jenkins.
Create a Shell Script to run all instructed command to install Jenkins on Ubuntu jenkins.sh
sh jenkins.sh
––
3. Jdk
Eclipse termurin installer plugin
Once plugin install successfully, we need to configure the sonar server properties. Go
to Jenkins home Manage Jenkins configure system SonarQube Servers and
add the properties appropriate filed.
Jdk17 – install from adaptiuim
In the PROJECTS section, we can find project details available now. Click on the project
name:
Click on github
sonar.projectKey=website
node {
stage('SCM') {
checkout scm
stage('SonarQube Analysis') {
withSonarQubeEnv() {
sh "${scannerHome}/bin/sonar-scanner"
Install plugin
CLOUD ASEEM cloud aseem - YouTube