Issue with SonarQube integration in Jenkins
Hello,
I'm currently attempting to integrate code scanning from my repository using SonarScanner in Jenkins. Here's the current setup:
Within Jenkins, I have the "SonarQube Scanner for Jenkins" plugin installed, and the SonarQube server and its credentials properly configured in the System Configuration section. I've also marked the option to install the SonarScanner through Jenkins.
Regarding the Jenkins project, it is set up as a "Freestyle project." In the project's configuration, the "Source Code Management" section is set to "git" pointing to my repository (https://github.com/StefanVlad27/prueba_svlad.git). The rest of the configuration is set to default, except for the "Build steps" section, where there is an action for "Execute SonarQube scanner" with only the name specified.
Additionally, it's worth mentioning that my Git repository contains a sonar-project.properties file, which SonarScanner uses to retrieve the configuration.
On the surface, this configuration appears to be correct, and I've followed the official guides. However, when I run Jenkins, I encounter the following output:
Started by user Stefan Vlad
Running as SYSTEM
Building in workspace /var/lib/jenkins/workspace/prueba-freestyle
The recommended git tool is: NONE
No credentials specifiedgit rev-parse --resolve-git-dir /var/lib/jenkins/workspace/prueba-freestyle/.git # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/StefanVlad27/prueba_svlad.git # timeout=10
Fetching upstream changes from https://github.com/StefanVlad27/prueba_svlad.git
git --version # timeout=10
git --version # 'git version 2.34.1'
git fetch --tags --force --progress -- https://github.com/StefanVlad27/prueba_svlad.git +refs/heads/:refs/remotes/origin/ # timeout=10
git rev-parse refs/remotes/origin/main^{commit} # timeout=10Checking out Revision 942e61db4cd551d49468b6c5366880eff9e1af3c (refs/remotes/origin/main)
git config core.sparsecheckout # timeout=10
git checkout -f 942e61db4cd551d49468b6c5366880eff9e1af3c # timeout=10Commit message: "Update sonar-project.properties"
git rev-list --no-walk 307fdffdfb12dc824369a90451d977747eb2ccda # timeout=10
[prueba-freestyle] $ /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonnar-scanner-install/bin/sonar-scanner sonnar-scan1 -X -Dsonar.host.url=http://arq9-alb-886148692.eu-west-1.elb.amazonaws.com:9000/ ******** -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/prueba-freestyle
13:48:11.355 INFO: Scanner configuration file: /var/lib/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonnar-scanner-install/conf/sonar-scanner.properties
13:48:11.360 INFO: Project root configuration file: /var/lib/jenkins/workspace/prueba-freestyle/sonar-project.properties
13:48:11.421 INFO: SonarScanner 4.8.0.2856
13:48:11.422 INFO: Java 17.0.7 Private Build (64-bit)
13:48:11.422 INFO: Linux 5.19.0-1028-aws amd64
13:48:11.674 DEBUG: keyStore is :
13:48:11.674 DEBUG: keyStore type is : pkcs12
13:48:11.674 DEBUG: keyStore provider is :
13:48:11.674 DEBUG: init keystore
13:48:11.674 DEBUG: init keymanager of type SunX509
13:48:11.802 DEBUG: Create: /var/lib/jenkins/.sonar/cache
13:48:11.803 INFO: User cache: /var/lib/jenkins/.sonar/cache
13:48:11.803 DEBUG: Create: /var/lib/jenkins/.sonar/cache/_tmp
13:48:11.805 DEBUG: Extract sonar-scanner-api-batch in temp...
13:48:11.809 DEBUG: Get bootstrap index...
13:48:11.809 DEBUG: Download: http://arq9-alb-886148692.eu-west-1.elb.amazonaws.com:9000/batch/index
13:48:11.873 DEBUG: Get bootstrap completed
13:48:11.876 DEBUG: Create isolated classloader...
13:48:11.896 DEBUG: Start temp cleaning...
13:48:11.899 DEBUG: Temp cleaning done
13:48:11.899 DEBUG: Execution getVersion
13:48:11.912 INFO: Analyzing on SonarQube server 9.9.1.69595
13:48:11.913 DEBUG: Execution execute
13:48:12.258 DEBUG: Community 9.9.1.69595
13:48:12.523 INFO: Load global settings
13:48:12.575 DEBUG: GET 200 http://arq9-alb-886148692.eu-west-1.elb.amazonaws.com:9000/api/settings/values.protobuf | time=50ms
13:48:12.612 INFO: Load global settings (done) | time=89ms
13:48:12.615 INFO: Server id: 86E1FA4D-AYkhTBas4owBNcLPG1Rt
13:48:12.621 INFO: User cache: /var/lib/jenkins/.sonar/cache
13:48:12.624 INFO: Load/download plugins
13:48:12.624 INFO: Load plugins index
13:48:12.632 DEBUG: GET 200 http://arq9-alb-886148692.eu-west-1.elb.amazonaws.com:9000/api/plugins/installed | time=8ms
13:48:12.668 INFO: Load plugins index (done) | time=44ms
13:48:12.742 INFO: Load/download plugins (done) | time=118ms
13:48:12.824 DEBUG: Plugins:
13:48:12.824 DEBUG: * Python Code Quality and Security 3.24.0.10784 (python)
13:48:12.824 DEBUG: * Go Code Quality and Security 1.11.0.3905 (go)
13:48:12.825 DEBUG: * JaCoCo 1.3.0.1538 (jacoco)
13:48:12.825 DEBUG: * Kotlin Code Quality and Security 2.12.0.1956 (kotlin)
13:48:12.826 DEBUG: * IaC Code Quality and Security 1.11.0.2847 (iac)
13:48:12.826 DEBUG: * JavaScript/TypeScript/CSS Code Quality and Security 9.13.0.20537 (javascript)
13:48:12.826 DEBUG: * Ruby Code Quality and Security 1.11.0.3905 (ruby)
13:48:12.826 DEBUG: * SQL language plugin 1.2.0 (sql)
13:48:12.827 DEBUG: * Scala Code Quality and Security 1.11.0.3905 (sonarscala)
13:48:12.827 DEBUG: * C# Code Quality and Security 8.51.0.59060 (csharp)
13:48:12.827 DEBUG: * Java Code Quality and Security 7.16.0.30901 (java)
13:48:12.827 DEBUG: * HTML Code Quality and Security 3.7.1.3306 (web)
13:48:12.827 DEBUG: * Flex Code Quality and Security 2.8.0.3166 (flex)
13:48:12.828 DEBUG: * XML Code Quality and Security 2.7.0.3820 (xml)
13:48:12.828 DEBUG: * PHP Code Quality and Security 3.27.1.9352 (php)
13:48:12.828 DEBUG: * Text Code Quality and Security 2.0.2.1090 (text)
13:48:12.828 DEBUG: * VB.NET Code Quality and Security 8.51.0.59060 (vbnet)
13:48:12.828 DEBUG: * Configuration detection fot Code Quality and Security 1.2.0.267 (config)
13:48:12.902 INFO: ------------------------------------------------------------------------
13:48:12.903 INFO: EXECUTION FAILURE
13:48:12.903 INFO: ------------------------------------------------------------------------
13:48:12.904 INFO: Total time: 1.594s
13:48:12.922 INFO: Final Memory: 6M/27M
13:48:12.922 INFO: ------------------------------------------------------------------------
13:48:12.922 ERROR: Error during SonarScanner execution
Tasks support was removed in SonarQube 7.6.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed?
ERROR: SonarQube scanner exited with non-zero code: 2
Finished: FAILURE
If you require any additional information, please don't hesitate to ask.
Thank you for your assistance.
EDIT: Please note that the repository mentioned above is a testing repository, and the code provided consists of random open-source files.
Comments
-
Hi @stefanvlad27,
Sorry for the late response, but some labs are long to reproduce.
1.- It seems that "ERROR: Error during SonarScanner execution" and "ERROR: SonarQube scanner exited with non-zero code: 2" could be produced for more than just one thing:
https://community.sonarsource.com/t/execution-failure-tasks-support-was-removed/8698/6
https://stackoverflow.com/questions/63569411/tasks-support-was-removed-in-sonarqube-7-6
https://community.sonarsource.com/t/sonarqube-scanner-exited-with-non-zero-code-2/68440/3
So it seems it can be a miss configuration in SonarQube.
2.- Because of the previous point, I recommend to do it from the beginning, checking that the credentials are correctly, and the integration between SonarQube and Jenkins is the right one.
If it still fails, please let me know.
Regards,
Luis.0
Categories
- All Categories
- 145 LFX Mentorship
- 145 LFX Mentorship: Linux Kernel
- 832 Linux Foundation IT Professional Programs
- 380 Cloud Engineer IT Professional Program
- 184 Advanced Cloud Engineer IT Professional Program
- 84 DevOps Engineer IT Professional Program
- 153 Cloud Native Developer IT Professional Program
- 147 Express Training Courses & Microlearning
- 147 Express Courses - Discussion Forum
- Microlearning - Discussion Forum
- 6.8K Training Courses
- 49 LFC110 Class Forum - Discontinued
- 73 LFC131 Class Forum
- 51 LFD102 Class Forum
- 242 LFD103 Class Forum
- 22 LFD110 Class Forum
- 47 LFD121 Class Forum
- 1 LFD123 Class Forum
- LFD125 Class Forum
- 18 LFD133 Class Forum
- 9 LFD134 Class Forum
- 18 LFD137 Class Forum
- 72 LFD201 Class Forum
- 5 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 2 LFD233 Class Forum
- 4 LFD237 Class Forum
- 24 LFD254 Class Forum
- 730 LFD259 Class Forum
- 111 LFD272 Class Forum - Discontinued
- 4 LFD272-JP クラス フォーラム
- 13 LFD273 Class Forum
- 300 LFS101 Class Forum
- 2 LFS111 Class Forum
- 3 LFS112 Class Forum
- 3 LFS116 Class Forum
- 8 LFS118 Class Forum
- 1 LFS120 Class Forum
- 9 LFS142 Class Forum
- 8 LFS144 Class Forum
- 4 LFS145 Class Forum
- 5 LFS146 Class Forum
- 17 LFS148 Class Forum
- 16 LFS151 Class Forum
- 5 LFS157 Class Forum
- 73 LFS158 Class Forum
- LFS158-JP クラス フォーラム
- 12 LFS162 Class Forum
- 2 LFS166 Class Forum
- 7 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 3 LFS178 Class Forum
- 3 LFS180 Class Forum
- 2 LFS182 Class Forum
- 5 LFS183 Class Forum
- 35 LFS200 Class Forum
- 737 LFS201 Class Forum - Discontinued
- 3 LFS201-JP クラス フォーラム - Discontinued
- 21 LFS203 Class Forum
- 140 LFS207 Class Forum
- 2 LFS207-DE-Klassenforum
- 2 LFS207-JP クラス フォーラム
- 302 LFS211 Class Forum
- 56 LFS216 Class Forum
- 55 LFS241 Class Forum
- 50 LFS242 Class Forum
- 38 LFS243 Class Forum
- 16 LFS244 Class Forum
- 6 LFS245 Class Forum
- LFS246 Class Forum
- LFS248 Class Forum
- 119 LFS250 Class Forum
- 2 LFS250-JP クラス フォーラム
- 1 LFS251 Class Forum
- 158 LFS253 Class Forum
- 1 LFS254 Class Forum
- 2 LFS255 Class Forum
- 13 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.3K LFS258 Class Forum
- 11 LFS258-JP クラス フォーラム
- 137 LFS260 Class Forum
- 164 LFS261 Class Forum
- 43 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 24 LFS267 Class Forum
- 25 LFS268 Class Forum
- 37 LFS269 Class Forum
- 10 LFS270 Class Forum
- 202 LFS272 Class Forum - Discontinued
- 2 LFS272-JP クラス フォーラム
- 4 LFS147 Class Forum
- 2 LFS274 Class Forum
- 4 LFS281 Class Forum
- 25 LFW111 Class Forum
- 262 LFW211 Class Forum
- 186 LFW212 Class Forum
- 15 SKF100 Class Forum
- 1 SKF200 Class Forum
- 2 SKF201 Class Forum
- 797 Hardware
- 199 Drivers
- 68 I/O Devices
- 37 Monitors
- 104 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 85 Storage
- 763 Linux Distributions
- 82 Debian
- 67 Fedora
- 18 Linux Mint
- 13 Mageia
- 23 openSUSE
- 149 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 471 Linux System Administration
- 39 Cloud Computing
- 71 Command Line/Scripting
- Github systems admin projects
- 96 Linux Security
- 78 Network Management
- 102 System Management
- 47 Web Management
- 70 Mobile Computing
- 19 Android
- 38 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 381 Off Topic
- 116 Introductions
- 177 Small Talk
- 27 Study Material
- 811 Programming and Development
- 306 Kernel Development
- 487 Software Development
- 1.8K Software
- 263 Applications
- 183 Command Line
- 4 Compiling/Installing
- 988 Games
- 317 Installation
- 104 All In Program
- 104 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)