Update vars/sonarScan.groovy

This commit is contained in:
khaled committed 2026-09-30 14:43:37 +00:00
1 parent 6dae6d0a94
commit 3d80e984ee
1 file changed
+5 -5
+5 -5
View File
@@ -2,16 +2,16 @@
// Run a SonarQube analysis from the scanner container. // Run a SonarQube analysis from the scanner container.
// Usage: sonarScan('my-project-key') // Usage: sonarScan('my-project-key')
def call(String projectKey, Map config = [:]) { def call(String projectKey, Map config = [:]) {
def host = config.host ?: 'http://10.0.1.4:9000' def host = config.host ?: 'http://10.0.1.4:9000'
def sources = config.sources ?: '.' def sources = config.sources ?: '.'
container('scanner') { container('scanner') {
stage('SonarQube analysis') { stage('SonarQube analysis') {
withCredentials([string(credentialsId: 'sonarqube-token', variable: 'SONAR_TOKEN')]) { withCredentials([string(credentialsId: 'sonarqube-token', variable: 'SONAR_TOKEN')]) {
sh """ sh """
sonar-scanner \ sonar-scanner \\
-Dsonar.host.url=${host} \ -Dsonar.host.url=${host} \\
-Dsonar.projectKey=${projectKey} \ -Dsonar.projectKey=${projectKey} \\
-Dsonar.sources=${sources} \ -Dsonar.sources=${sources} \\
-Dsonar.token=\${SONAR_TOKEN} -Dsonar.token=\${SONAR_TOKEN}
""" """
} }