Bitbucket + Jenkins + SonarQube

Neerajpaliwal
4 min readFeb 3, 2021

SonarQube

Step 1: Download PostgresSql 12.X from https://www.enterprisedb.com/downloads/postgres-postgresql-downloads

Step 2: Install PostgresSql

Step 3: Open PGAdmin 4

Enter Password In Browser which You are Set During Installation.

Step 4: Create Database

DB NAME: SonarQube

Step 5: Download Sonarqube Latest Version From

https://www.sonarqube.org/downloads/

Step 6: Unzip The File

Step 7: Now Go to the D:\sonarqube\sonarqube-8.5.0.37579\conf

Step 8: Open wrapper.conf

Set Java Path :

Note: Install Java 11 For this

Step 9: Open Sonar.properties

Add below lines in file:-

sonar.jdbc.username=postgres

sonar.jdbc.password=root

sonar.jdbc.url=jdbc:postgresql://localhost/sonar

Step 10:

Create SonarQube Service using

sc create SonarQube binPath= “\”D:\sonarqube\sonarqube-8.5.0.37579\bin\windows-x86–64\wrapper.exe\” -s D:\sonarqube\sonarqube-8.5.0.37579\conf\wrapper.conf”

Step 11: Login http://192.168.xx.xx:9000/

Username: admin

Password: admin

Install Jenkins :

Step 1: Download Docker Installer from https://hub.docker.com/editions/community/docker-ce-desktop-windows/

Install WSL Engine

https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

After Installing Docker open cmd & Run

docker pull jenkins/jenkins.

Step 2: Open Docker Now You can see the image which you pull from cmd.

Run the jenkis Image Shown in below images.

Step 3: http://192.168.xx.xx:8080/login?from=%2F

Login Using the Key after that reset the password

Note : Install All Recommended Plugins By Jenkins.

From Manage Plugin Installed all plugin Required for Sonarqube, Btbucket, Github.

Configure Jenkins For SonarQube & Bitbucket

Select Configure System

Enter Sonar Qube Detail Mentioned Below

Add Global Tool Configuration

Add SonarScanner & Node Details also Add jdk in uper section

Work Flow From BitBucket + Jenkins + SonarQube

Step1:

Login to Bitbucket

Go To Personal Setting in your Profile

Add SSH key as mentioned below in image.

Now Add Project In Jenkins :-

Add New Item

Enter Project Name. Choose Free Style project

Select Source URL & Credential Details. From Where you pool the Project

Add Credentials details:-

Add key details in manage credential destails & Use where you want.

After Adding Source Choose Sonar scanner From Build Section Add below details & save the project

After Save Click On Build Now

After Successfully Build Project Shown In SonarQube:-

Thanks.

--

--