We'll use a Node.js application for the example, but the same process can be exported for other types of applications.
Configure SonarQube plugin in Jenkins.
From Jenkins -> Manage Jenkins -> Configure global tools configurations, install the plugin automatically in this section:

Create a user named Jenkins and a token in SonarQube.
In Administration -> Security click on the "Create User" button and give it "jenkins" name.
Generate a new token for the user:

Annotate the token.
Create a secret text credential on Jenkins for SonarQube token.
Go to Jenkins -> Credentials -> Global Credentials -> Add credentials
Name the secret "sonarqube_token" and give it the same id. The secret text is the token created before on SonarQube.

Configure SonarQube references on Jenkins.
From Jenkins -> Manage Jenkins -> Global tools go to "SonarQube Server" section.
Insert a name and SonarQube server url.

Create the pipeline.
Here's the example pipeline:
No comments:
Post a Comment