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.
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_shaApplying these parameters allows SonarQube to display the branch and commit details in its analysis results, providing clearer traceability of code quality across CI pipelines.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
