Setting up Jenkins
This page explains how to set up Jenkins globally for the integration with SonarQube Cloud.
The Jenkins extension for SonarQube facilitates a global integration with SonarQube Cloud. Using the Jenkins extension is not mandatory but allows a centralized installation and setup of the SonarScanner directly from Jenkins.
Proceed as follows:
Install the Jenkins extension.
Install the SonarScanner from Jenkins.
Set up the multi-branch features.
These steps are explained below.
Installing the Jenkins extension
Jenkins extension version 2.11 or later is required.
Proceed as follows:
From the Jenkins Dashboard, navigate to Manage Jenkins > Manage Plugins and install the SonarQube Scanner plugin.
Back at the Jenkins Dashboard, navigate to Credentials > System from the left navigation.
Click the Global credentials (unrestricted) link in the System table.
Click Add credentials in the left navigation and add the following information:
Kind: Secret Text
Scope: Global
Secret: Generate a token at User > My Account > Security in SonarQube Cloud, and copy and paste it here.
Click OK.
From the Jenkins Dashboard, navigate to Manage Jenkins > Configure System.
From the SonarQube Servers section, click Add SonarQube. Add the following information:
Name: SonarQube Cloud
Server URL: https://sonarcloud.io
Credentials: Select the credentials created during step 4.
Click Save
Installing the SonarScanner
From Jenkins, install and configure the SonarScanner instance(s). This step depends on the project type.
Log into Jenkins as an administrator and go to Manage Jenkins > Configure System.
Scroll to the SonarQube servers section and check Enable injection of SonarQube server configuration as build environment variables.
Setting up the multi-branch features
To analyze Jenkins Multibranch Pipeline jobs, you must install, on your CI host, the Branch Source plugin for Jenkins corresponding to your DevOps platform.
GitHub Branch Source plugin version 2.7.1 or later is required
From the Jenkins Dashboard, navigate to Manage Jenkins > Manage Plugins and install the GitHub Branch Source plugin.
From the Jenkins Dashboard, navigate to Manage Jenkins > Configure System.
From the GitHub or GitHub Enterprise Servers section, add your GitHub server.
Select Save.
Other settings
To set up an automatic interruption of the pipeline in case the quality gate fails, configure your Webhooks at the global level when used in pipeline jobs. Interrupting your pipeline (with a failed quality gate) is only available in Team plans. See the Subscription plans page for more details.
Last updated
Was this helpful?