fix: use sonar-scanner-cli container instead of npx for sonar scan
npx sonar-scanner fails on node:18-slim — no Java. Switch to dedicated sonarsource/sonar-scanner-cli container with Java + scanner bundled. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* Runs sonar-scanner via npx inside current container.
|
||||
* Must be called inside container('node') block.
|
||||
* Runs sonar-scanner inside container('sonar') (sonarsource/sonar-scanner-cli).
|
||||
* Must be called inside container('sonar') block.
|
||||
* Agent pod must be created with homelabK8sAgent(withSonar: true).
|
||||
*
|
||||
* config keys:
|
||||
* projectKey (required) - SonarQube project key
|
||||
@@ -22,7 +23,7 @@ def call(Map config) {
|
||||
|
||||
withCredentials([string(credentialsId: credId, variable: 'SONAR_TOKEN')]) {
|
||||
sh """
|
||||
npx sonar-scanner \
|
||||
sonar-scanner \
|
||||
-Dsonar.projectKey=${projectKey} \
|
||||
-Dsonar.sources=${sources} \
|
||||
-Dsonar.host.url=${sonarUrl} \
|
||||
|
||||
Reference in New Issue
Block a user