Automating the integration of sonarqube with jenkins

I have my Jenkins and Sonarqube server up and running. I have deployed my sonarqube server on EKS using Kubernetes-Helm deployment. I now want to integrate jenkins with sonarqube, but i am confused on how to incorporate the sonarscanner. Is the plugin installation of sonarscanner on the Jenkins UI just enough? or would i need to download it on jenkins UI via the docker image?

Thanks in advance!

Hey there.

Have you read through the documentation on the SonarScanner for Jenkins?

Hi Colin ! Yes I went through the document but I am confused whether to run sonarscanner independently on my local machine or configure it on jenkins? Also i am trying to automate and I read that we need sonar runner to analyse the project, how should i be moving forward with that?

Thank you!

First you need to configure your Jenkins server to know about your SonarQube servers.

Installation

  1. Install the SonarScanner for Jenkins via the Jenkins Update Center.
  2. Configure your SonarQube server(s):
  3. Log into Jenkins as an administrator and go to Manage Jenkins > Configure System.
  4. Scroll down to the SonarQube configuration section, click Add SonarQube, and add the values you’re prompted for.
  5. The server authentication token should be created as a ‘Secret Text’ credential.

Make sure that you have installed a global tool so that the scanner runs on your jenkins agents, under Manage Jenkins > Global Tool Configuration

And then add SonarQube analysis to your job/pipeline. This is all laid out in the documentation, with examples for different project types!

1 Like