Operations 1 min read

Configuring SonarQube Scan Parameters to Include Branch and Commit Information

This guide explains how to configure SonarQube scan parameters to automatically include the current GitLab branch name and commit SHA, enabling detailed code‑quality reporting within CI pipelines; it also shows the required command‑line flags and how to set up the Reporting section with GitLab credentials.

DevOps Cloud Academy
DevOps Cloud Academy
DevOps Cloud Academy
Configuring SonarQube Scan Parameters to Include Branch and Commit Information

During code scanning, you can retrieve the current branch name and commit information and add them to SonarQube scan parameters.

The main configuration is in the Reporting section, where you set the GitLab address, project ID, and user token.

Typical SonarQube scan parameters are:

-Dsonar.analysis.mode=preview
-Dsonar.gitlab.ref_name=branch_name
-Dsonar.gitlab.project_id=group/repo_name
-Dsonar.gitlab.commit_sha=commit_sha

Applying these parameters allows SonarQube to display the branch and commit details in its analysis results, providing clearer traceability of code quality across CI pipelines.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DevOpsGitLabcode qualitystatic analysisCISonarQube
DevOps Cloud Academy
Written by

DevOps Cloud Academy

Exploring industry DevOps practices and technical expertise.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.