I was using SonarQube 5.1.2 with Sonar-runner-dist 2.4 but I have to upgrade my SonarQube to 6.0 along with Sonar-Scanner-2.6.1
I was using MySQL for SonarQube 5.1.2 but When I upgraded to SonarQube 6.0 I am getting this error , Can someone help me how to override the error and what changes required with SonarQube 6.0
Not Sure why I am getting
WARN: Property 'sonar.jdbc.username' is not supported any more. It will be ignor
ed. There is no longer any DB connection to the SQ database.
Complete Error Log
WARN: sonar-runner.bat script is deprecated. Please use sonar-scanner.bat instea
d.
D:\Softwares\SonarQube_old\sonar-scanner-2.6.1\sonar-scanner-2.6.1
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
INFO: Scanner configuration file: D:\Softwares\SonarQube_old\sonar-scanner-2.6.1
\sonar-scanner-2.6.1\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.8.0_111 Oracle Corporation (32-bit)
INFO: Windows 7 6.1 x86
INFO: User cache: C:\Users\391007\.sonar\cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=124ms
WARN: Property 'sonar.jdbc.url' is not supported any more. It will be ignored. T
here is no longer any DB connection to the SQ database.
WARN: Property 'sonar.jdbc.username' is not supported any more. It will be ignor
ed. There is no longer any DB connection to the SQ database.
WARN: Property 'sonar.jdbc.password' is not supported any more. It will be ignor
ed. There is no longer any DB connection to the SQ database.
INFO: User cache: C:\Users\391007\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=9ms
INFO: SonarQube server 6.0
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is
platform dependent)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 2.553s
INFO: Final Memory: 40M/96M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to register extension com.sonar.governance.task.A.A from plugin 'g
overnance'
ERROR: Caused by: Lorg/sonar/batch/bootstrap/BatchWsClient;
ERROR: Caused by: org.sonar.batch.bootstrap.BatchWsClient
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Scanner with
the -e switch.
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging
I have referred below Answer but I am not getting solution to solve the problem
https://stackoverflow.com/a/35231407/3973543
"WARN: Property 'sonar.jdbc.url' is not supported any more " is not an error, just a warning, since 5.6 sonar.jdbc.url, sonar.jdbc.username and sonar.jdbc.password are not needed anymore in jenkins side. The sonarqube DataBase is only access from sonarqube instance, not from the clients as jenkins. So you should let them empty now. Just fill the sonarqube instance url for the WS connection.
Governance plugin is now commercial, you have to registry a license for using it
Related
I have a Sonar analysis job in Jenkins which was working fine. Suddenly last week it started throwing error when uploading the report to Sonarqube server.
11:47:31 06:17:31.409 INFO: Analysis report generated in /var/jenkins_home/workspace/projectdirmasked/sample/.scannerwork/scanner-report
11:47:31 06:17:31.409 DEBUG: Upload report
11:47:31 06:17:31.481 DEBUG: POST 403 https://sonarqubehostnamemasked.com/api/ce/submit?projectKey=Sonar_Test&projectName=Sonar_Test | time=72ms
11:47:31 06:17:31.486 INFO: ------------------------------------------------------------------------
11:47:31 06:17:31.486 INFO: EXECUTION FAILURE
11:47:31 06:17:31.486 INFO: ------------------------------------------------------------------------
11:47:31 06:17:31.486 INFO: Total time: 9.877s
11:47:31 06:17:31.621 INFO: Final Memory: 39M/421M
11:47:31 06:17:31.621 INFO: ------------------------------------------------------------------------
11:47:31 06:17:31.621 ERROR: Error during SonarScanner execution
11:47:31 You're not authorized to run analysis. Please contact the project administrator.
The user belongs to the token has admin access. As well execute-analysis permission. And basically the user has assigned all the available permission in Sonarqube. So definitely it is not permission issue on the user.
All other projects using the same token in the same jenkins are able to scan successfully and upload the report.
Version: Enterprise Sonarqube 8.9.6
csharp plugin version: 8.22.0, xml plugin version: 2.2.0 (as I am scanning cs and xml files)
Any leads on this will be helpful!
I've got an error during phpunit coverage report parsing with SonarQube Scanner 2.8 with following message :
Metric 'it_lines_to_cover' should not be computed by a Sensor
Thanks in advance,
Versions :
10:42:57.262 INFO: SonarQube Scanner 2.8
10:42:57.262 INFO: Java 1.8.0_111 Oracle Corporation (64-bit)
10:42:57.262 INFO: Linux 3.13.0-103-generic amd64
10:43:08.803 DEBUG: * PHP 2.9.1.1705 (php)
Error log :
10:43:18.046 INFO: Sensor PHP sensor
10:43:18.420 INFO: 78 source files to be analyzed
10:43:21.533 INFO: 78/78 source files have been analyzed
10:43:21.543 INFO: PHPUnit xml test report not found: tests/build
/logs/junit_unit.xml
10:43:21.544 INFO: PHPUnit xml unit test coverage report not found:
tests/build/logs/clover-unit.xml
10:43:21.544 INFO: Analyzing PHPUnit integration test coverage report:
tests/build/logs/clover-integration.xml with PHPUnit IT Coverage Result Parser
10:43:21.544 DEBUG: Parsing file: /home/travis/build/armadito
/glpi/plugins/armadito/tests/build/logs/clover-integration.xml
10:43:23.079 DEBUG: Coverage metrics have not been set on 'index.php':
default values will be inserted.
------------------------------------------------------------------------
10:43:23.084 INFO: EXECUTION FAILURE
10:43:23.084 INFO:
------------------------------------------------------------------------
10:43:23.515 ERROR: Error during SonarQube Scanner execution
java.lang.UnsupportedOperationException: Metric 'it_lines_to_cover' should not be computed by a Sensor
at org.sonar.scanner.sensor.DefaultSensorStorage.saveMeasure(DefaultSensorStorage.java:240)
at org.sonar.scanner.sensor.DefaultSensorStorage.store(DefaultSensorStorage.java:213)
at org.sonar.api.batch.sensor.measure.internal.DefaultMeasure.doSave(DefaultMeasure.java:93)
at org.sonar.api.batch.sensor.internal.DefaultStorable.save(DefaultStorable.java:43)
at org.sonar.plugins.php.phpunit.PhpUnitCoverageResultParser.saveMeasureForMissingFiles(PhpUnitCoverageResultParser.java:129)
at org.sonar.plugins.php.phpunit.PhpUnitCoverageResultParser.parseFile(PhpUnitCoverageResultParser.java:102)
at org.sonar.plugins.php.phpunit.PhpUnitCoverageResultParser.parse(PhpUnitCoverageResultParser.java:84)
at org.sonar.plugins.php.phpunit.PhpUnitService.parseReport(PhpUnitService.java:74)
at org.sonar.plugins.php.phpunit.PhpUnitService.execute(PhpUnitService.java:60)
at org.sonar.plugins.php.PHPSensor.processCoverage(PHPSensor.java:142)
at org.sonar.plugins.php.PHPSensor.execute(PHPSensor.java:132)
This message will disappear once https://jira.sonarsource.com/browse/SONARPHP-658 is implemented. It is scheduled for next release of the PHP plugin.
Our sonarqube server is behind http basic authentication and local runner fails with 401 error. Is it somehow possible to provide credentials to it? AOfficial docs shows how to provide sonarqube's internal user...
UPD #1:
sonarqube: v5.3,
sonar-runner: v2.5
Debug log of runner:
INFO: Scanner configuration file: /Users/user/Documents/Projects/Project1/sonar-scanner-2.5/conf/sonar-runner.properties
INFO: Project configuration file: /Users/user/Documents/Projects/Project1/sonar-project.properties
INFO: SonarQube Scanner 2.5
INFO: Java 1.8.0_45 Oracle Corporation (64-bit)
INFO: Mac OS X 10.11.3 x86_64
INFO: Error stacktraces are turned on.
DEBUG: cache: /Users/user/.sonar/ws_cache/https%3A%2F%2Fexample.com%2Fsonar%2F/global
INFO: User cache: /Users/user/.sonar/cache
DEBUG: Extract sonar-runner-batch in temp...
DEBUG: Get bootstrap index...
DEBUG: Download: https://example.com/sonar/batch_bootstrap/index
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 1.171s
INFO: Final Memory: 5M/245M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
org.sonar.runner.impl.RunnerException: Unable to execute SonarQube
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:100)
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:87)
at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:83)
at org.sonar.runner.api.EmbeddedRunner.doStart(EmbeddedRunner.java:249)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:187)
at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:182)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:66)
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
at org.sonar.runner.impl.Jars.downloadFiles(Jars.java:93)
at org.sonar.runner.impl.Jars.download(Jars.java:70)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:91)
... 9 more
Caused by: java.lang.IllegalStateException: Status returned by url [https://example.com/sonar/batch_bootstrap/index] is not valid: [401]
at org.sonar.runner.impl.ServerConnection.callUrl(ServerConnection.java:186)
at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:121)
at org.sonar.runner.impl.ServerConnection.tryServerFirst(ServerConnection.java:148)
at org.sonar.runner.impl.ServerConnection.download(ServerConnection.java:112)
at org.sonar.runner.impl.Jars.downloadFiles(Jars.java:78)
... 12 more
No it doesn't look like sonar-runner supports proxy authentication. SonarQube has built-in access control so I'm not sure why you'd need proxy authentication on top of that. Maybe you could disable proxy authentication for SonarQube's URL.
The sonar-runner, even if configured with credentials, does not use these to make it's first call to the server. The endpoint is /batch/index. You have to allow public access to that endpoint. For all other urls basic auth is fine.
More details about my working setup in my answer here: https://stackoverflow.com/a/60132667/1838233
I've tried that setup with the runner and a sonar-project.properties file containing:
sonar.host.url=https://myserver/sonar/
sonar.login=${env.SONARUSER}
sonar.password=${env.SONARPWD}
and could access Sonar behind Apache basic auth that way.
I have been looking for this too and failed to find any options to allow this. One use case I can think of for needing this is you have the sonar client running on the far end of a GCP IAP away from the sonar server. You'd need to have the client pass through the initial proxy to get to the sonar server. Even if the sonar server supports this auth natively you need some way for the client to pass an auth header.
This is for scenarios where you either don't trust sonar or you don't trust the deployment of sonar by some novice, but you do trust a zero-trust protected proxy by gcp's platform
With each run done by console or by Jenkins throws me the following error:
SonarQube Runner 2.4
Java 1.8.0_51 Oracle Corporation (32-bit)
Linux 2.6.32-504.30.3.el6.i686 i386
INFO: Runner configuration file: /usr/local/sonar-runner/conf/sonar-runner.properties
INFO: Project configuration file: /opt/apps/php-sonar-runner/sonar-project.properties
INFO: Default locale: "es_ES", source code encoding: "UTF-8"
INFO: Work directory: /opt/apps/php-sonar-runner/./.sonar
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.042s
Final Memory: 0M/28M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Fail to request server version
ERROR: Caused by: Status returned by url : 'http://xxx.xxx.xx.xxx:9000/api/server/version' is invalid : 404
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Open the URL 'http://xxx.xxx.xx.xxx:9000/api/server/version' in a browser, see if it gives you a 404 error. If so, you need to find the right path to Sonar root on the remote server, maybe 'http://xxx.xxx.xx.xxx:9000/sonar/'?
When you have the full URL of Sonar, update the sonar.host.url property in your pom accordingly. See full documentation for more details.
Check the value of sonar.web.context = /myPath maybe you have some path and you configure other path in your url at your jenkis, tfs, etc. That is the reason you get an 404 error.
In your example you should not have that value configurated or without a value.
'http://xxx.xxx.xx.xxx:9000/myPath/api/server/version
In your sonar-runner.properties file
define #--- Default SonarQube sever as give below
sonar.host.url=http://localhost:9000/sonar
Also cross check in sonar.properties file i.e
sonar.web.port=9000
sonar.web.host=127.0.0.1
sonar.web.context=/sonar
When I try to run sonar-runner from the command line for a project, I get a 500 error:
INFO - Install plugins
INFO - Install JDBC driver
INFO - Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 12.320s
Final Memory: 7M/152M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: Fail to download [http://localhost:9000/api/server]. Response code: 500
UpDate
I think this is caused by conflit with local ruby version as I have in sonar.log this description:
ERROR web[o.s.s.ui.JRubyFacade] Fail to render: http://localhost:9000/api/server/index?format=json
undefined method `generate' for #<JSON::Ext::Generator::State:0x10b4e1f2>
/Users/me/.rvm/gems/ruby-1.9.3-p448/gems/json-1.8.1/lib/json/common.rb:223:in `generate'
/Users/me/.rvm/gems/ruby-1.9.3-p448/gems/json-1.8.1/lib/json/common.rb:470:in `JSON'
How can I fix this? Thanks
I found an old bug in the SonarQube issue tracker (http://jira.sonarsource.com/browse/SONAR-3579) that describes the same problem, it is indeed a compatibility issue. It is suggested as a workaround to unset GEM_PATH and GEM_HOME variables before launching Sonar.
I put the following two lines into the sonar startup script:
unset GEM_PATH
unset GEM_HOME
A restart of the sonar service solved the problem for me in SonarQube Version 5.1.1 and SonarQube Runner 2.4.