Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
Sonarqube scanner: 4.7.0 2747
Sonarqube server: 8.9.8.54436
Jenkins: 2.332.2
Kubernetes (MicroK8s): 1.23.5-2+c812603a312d2b
Sonarqube Scanner plugin for Jenkins: 2.14
Kubernetes plugin for Jenkins: 3580.v78271e5631dc - what are you trying to achieve
Have a result from sonarqube in my Jenkins pipeline. - what have you tried so far to achieve this
I create a Jenkinsfile and run it on my Jenkins slave architecture.
My Jenkinsfile:
pipeline {
agent {
kubernetes {
yaml '''
apiVersion: v1
kind: Pod
spec:
containers:
- name: docker-in-docker
image: docker.io/library/docker:latest
tty: true
'''
}
}
stages {
stage('SAST') {
environment {
scannerHome = tool 'sonar-scanner'
}
steps {
withSonarQubeEnv('sonarqube-server') {
sh '''
${scannerHome}/bin/sonar-scanner \
-Dsonar.projectKey=simple_webapp \
-Dsonar.sources=. \
'''
}
}
}
stage('Build docker image') {
steps{
container('docker-in-docker') {
sh 'docker build -t quay.io/jesayafn:builded .'
sh 'docker images'
}
}
}
}
}
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (SAST)
[Pipeline] tool
Unpacking https://repo1.maven.org/maven2/org/sonarsource/scanner/cli/sonar-scanner-cli/4.7.0.2747/sonar-scanner-cli-4.7.0.2747.zip to /home/jenkins/agent/tools/hudson.plugins.sonar.SonarRunnerInstallation/sonar-scanner on xjoj-44-0xbgp-dx40n-9mqn7
[Pipeline] withEnv
[Pipeline] {
[Pipeline] withSonarQubeEnv
Injecting SonarQube environment variables using the configuration: sonarqube-server
[Pipeline] {
[Pipeline] sh
process apparently never started in /home/jenkins/agent/workspace/'joj@tmp/durable-c898d1de
(running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
[Pipeline] }
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Build docker image)
Stage "Build docker image" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: script returned exit code -2
Finished: FAILURE