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
- 167 LFX Mentorship
- 219 LFX Mentorship: Linux Kernel
- 795 Linux Foundation IT Professional Programs
- 355 Cloud Engineer IT Professional Program
- 179 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 127 Cloud Native Developer IT Professional Program
- 112 Express Training Courses
- 112 Express Courses - Discussion Forum
- 6.2K Training Courses
- 48 LFC110 Class Forum - Discontinued
- 17 LFC131 Class Forum
- 35 LFD102 Class Forum
- 227 LFD103 Class Forum
- 14 LFD110 Class Forum
- 39 LFD121 Class Forum
- 15 LFD133 Class Forum
- 7 LFD134 Class Forum
- 17 LFD137 Class Forum
- 63 LFD201 Class Forum
- 3 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 1 LFD233 Class Forum
- 2 LFD237 Class Forum
- 23 LFD254 Class Forum
- 697 LFD259 Class Forum
- 109 LFD272 Class Forum
- 3 LFD272-JP クラス フォーラム
- 10 LFD273 Class Forum
- 152 LFS101 Class Forum
- 1 LFS111 Class Forum
- 1 LFS112 Class Forum
- 1 LFS116 Class Forum
- 1 LFS118 Class Forum
- LFS120 Class Forum
- 7 LFS142 Class Forum
- 7 LFS144 Class Forum
- 3 LFS145 Class Forum
- 1 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 1 LFS157 Class Forum
- 33 LFS158 Class Forum
- 8 LFS162 Class Forum
- 1 LFS166 Class Forum
- 1 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 1 LFS178 Class Forum
- 1 LFS180 Class Forum
- 1 LFS182 Class Forum
- 1 LFS183 Class Forum
- 29 LFS200 Class Forum
- 736 LFS201 Class Forum - Discontinued
- 2 LFS201-JP クラス フォーラム
- 14 LFS203 Class Forum
- 102 LFS207 Class Forum
- 1 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 301 LFS211 Class Forum
- 55 LFS216 Class Forum
- 48 LFS241 Class Forum
- 42 LFS242 Class Forum
- 37 LFS243 Class Forum
- 15 LFS244 Class Forum
- LFS245 Class Forum
- LFS246 Class Forum
- 50 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 154 LFS253 Class Forum
- LFS254 Class Forum
- LFS255 Class Forum
- 5 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.3K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 111 LFS260 Class Forum
- 159 LFS261 Class Forum
- 41 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 20 LFS267 Class Forum
- 24 LFS268 Class Forum
- 29 LFS269 Class Forum
- 1 LFS270 Class Forum
- 199 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- 3 LFS281 Class Forum
- 9 LFW111 Class Forum
- 260 LFW211 Class Forum
- 182 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 782 Hardware
- 198 Drivers
- 68 I/O Devices
- 37 Monitors
- 96 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 83 Storage
- 743 Linux Distributions
- 80 Debian
- 67 Fedora
- 15 Linux Mint
- 13 Mageia
- 23 openSUSE
- 143 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 348 Ubuntu
- 461 Linux System Administration
- 39 Cloud Computing
- 70 Command Line/Scripting
- Github systems admin projects
- 90 Linux Security
- 77 Network Management
- 101 System Management
- 46 Web Management
- 64 Mobile Computing
- 17 Android
- 34 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 19 Study Material
- 507 Programming and Development
- 285 Kernel Development
- 204 Software Development
- 1.8K Software
- 211 Applications
- 180 Command Line
- 3 Compiling/Installing
- 405 Games
- 309 Installation
- 97 All In Program
- 97 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)