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
- 49 LFX Mentorship
- 102 LFX Mentorship: Linux Kernel
- 550 Linux Foundation Boot Camps
- 294 Cloud Engineer Boot Camp
- 118 Advanced Cloud Engineer Boot Camp
- 52 DevOps Engineer Boot Camp
- 53 Cloud Native Developer Boot Camp
- 4 Express Training Courses
- 4 Express Courses - Discussion Forum
- 1.9K Training Courses
- 18 LFC110 Class Forum
- 6 LFC131 Class Forum
- 25 LFD102 Class Forum
- 150 LFD103 Class Forum
- 17 LFD121 Class Forum
- 61 LFD201 Class Forum
- LFD210 Class Forum
- LFD210-CN Class Forum
- 1 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum
- LFD237 Class Forum
- 23 LFD254 Class Forum
- 596 LFD259 Class Forum
- 102 LFD272 Class Forum
- 1 LFD272-JP クラス フォーラム
- LFD273 Class Forum
- 2 LFS145 Class Forum
- 24 LFS200 Class Forum
- 739 LFS201 Class Forum
- 1 LFS201-JP クラス フォーラム
- 3 LFS203 Class Forum
- 69 LFS207 Class Forum
- 300 LFS211 Class Forum
- 54 LFS216 Class Forum
- 47 LFS241 Class Forum
- 41 LFS242 Class Forum
- 37 LFS243 Class Forum
- 11 LFS244 Class Forum
- 33 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 139 LFS253 Class Forum
- 1K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 92 LFS260 Class Forum
- 129 LFS261 Class Forum
- 32 LFS262 Class Forum
- 79 LFS263 Class Forum
- 15 LFS264 Class Forum
- 11 LFS266 Class Forum
- 17 LFS267 Class Forum
- 17 LFS268 Class Forum
- 23 LFS269 Class Forum
- 203 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS281 Class Forum
- 220 LFW211 Class Forum
- 166 LFW212 Class Forum
- SKF100 Class Forum
- 901 Hardware
- 219 Drivers
- 74 I/O Devices
- 44 Monitors
- 115 Multimedia
- 208 Networking
- 101 Printers & Scanners
- 85 Storage
- 761 Linux Distributions
- 88 Debian
- 66 Fedora
- 15 Linux Mint
- 13 Mageia
- 24 openSUSE
- 141 Red Hat Enterprise
- 33 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 476 Linux System Administration
- 41 Cloud Computing
- 69 Command Line/Scripting
- Github systems admin projects
- 94 Linux Security
- 77 Network Management
- 108 System Management
- 49 Web Management
- 66 Mobile Computing
- 23 Android
- 29 Development
- 1.2K New to Linux
- 1.1K Getting Started with Linux
- 536 Off Topic
- 131 Introductions
- 216 Small Talk
- 21 Study Material
- 816 Programming and Development
- 275 Kernel Development
- 507 Software Development
- 927 Software
- 260 Applications
- 183 Command Line
- 3 Compiling/Installing
- 76 Games
- 316 Installation
- 59 All In Program
- 59 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)