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
- 119 LFX Mentorship
- 119 LFX Mentorship: Linux Kernel
- 654 Linux Foundation IT Professional Programs
- 316 Cloud Engineer IT Professional Program
- 139 Advanced Cloud Engineer IT Professional Program
- 52 DevOps Engineer IT Professional Program
- 116 Cloud Native Developer IT Professional Program
- 8 Express Training Courses
- 8 Express Courses - Discussion Forum
- 5.4K Training Courses
- 17 LFC110 Class Forum - Discontinued
- 9 LFC131 Class Forum
- 30 LFD102 Class Forum
- 191 LFD103 Class Forum
- LFD110 Class Forum
- 24 LFD121 Class Forum
- LFD133 Class Forum
- 14 LFD137 Class Forum
- 62 LFD201 Class Forum
- 2 LFD210 Class Forum
- 1 LFD210-CN Class Forum
- 1 LFD213 Class Forum - Discontinued
- 127 LFD232 Class Forum - Discontinued
- LFD233 Class Forum
- LFD237 Class Forum
- 22 LFD254 Class Forum
- 643 LFD259 Class Forum
- 107 LFD272 Class Forum
- 1 LFD272-JP クラス フォーラム
- 6 LFD273 Class Forum
- 1 LFS101 Class Forum
- LFS112 Class Forum
- LFS116 Class Forum
- LFS118 Class Forum
- LFS142 Class Forum
- LFS144 Class Forum
- 2 LFS145 Class Forum
- LFS146 Class Forum
- LFS151 Class Forum
- LFS157 Class Forum
- LFS158 Class Forum
- LFS162 Class Forum
- LFS166 Class Forum
- LFS167 Class Forum
- LFS170 Class Forum
- LFS171 Class Forum
- LFS178 Class Forum
- LFS180 Class Forum
- LFS182 Class Forum
- LFS183 Class Forum
- 28 LFS200 Class Forum
- 735 LFS201 Class Forum - Discontinued
- 1 LFS201-JP クラス フォーラム
- 13 LFS203 Class Forum
- 98 LFS207 Class Forum
- 299 LFS211 Class Forum
- 54 LFS216 Class Forum
- 47 LFS241 Class Forum
- 41 LFS242 Class Forum
- 36 LFS243 Class Forum
- 12 LFS244 Class Forum
- LFS245 Class Forum
- 41 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 141 LFS253 Class Forum
- LFS254 Class Forum
- LFS255 Class Forum
- 2 LFS256 Class Forum
- LFS257 Class Forum
- 1.2K LFS258 Class Forum
- 9 LFS258-JP クラス フォーラム
- 110 LFS260 Class Forum
- 147 LFS261 Class Forum
- 39 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 20 LFS267 Class Forum
- 18 LFS268 Class Forum
- 26 LFS269 Class Forum
- 198 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- 3 LFS281 Class Forum
- LFW111 Class Forum
- 254 LFW211 Class Forum
- 173 LFW212 Class Forum
- 9 SKF100 Class Forum
- SKF200 Class Forum
- 781 Hardware
- 198 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 174 Networking
- 87 Printers & Scanners
- 83 Storage
- 742 Linux Distributions
- 80 Debian
- 66 Fedora
- 15 Linux Mint
- 13 Mageia
- 23 openSUSE
- 143 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 347 Ubuntu
- 451 Linux System Administration
- 31 Cloud Computing
- 69 Command Line/Scripting
- Github systems admin projects
- 89 Linux Security
- 77 Network Management
- 101 System Management
- 46 Web Management
- 52 Mobile Computing
- 18 Android
- 24 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 355 Off Topic
- 109 Introductions
- 167 Small Talk
- 18 Study Material
- 504 Programming and Development
- 283 Kernel Development
- 203 Software Development
- 1.1K Software
- 210 Applications
- 180 Command Line
- 3 Compiling/Installing
- 398 Games
- 308 Installation
- 51 All In Program
- 51 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)