SonarQube - Failed to get CE Task status - HTTP code 502 - sonarqube

I am trying to run sonarqube (hosted remotely) via SonarScanner command through local machine for magento application (for PHP), but getting below error every time. I tried to find solution for this, but didnt find much related to my issue
anyone has any idea about this error?
13:22:38.820 INFO: ------------- Check Quality Gate status
13:22:38.820 INFO: Waiting for the analysis report to be processed (max 600s)
13:22:38.827 DEBUG: GET 200 https://example.com/api/ce/task?id=AYE-URS3o9NiO9ce0vrw | time=7ms
13:22:43.845 DEBUG: GET 200 https://example.com/api/ce/task?id=AYE-URS3o9NiO9ce0vrw | time=11ms
13:22:48.854 DEBUG: GET 200 https://example.com/api/ce/task?id=AYE-URS3o9NiO9ce0vrw | time=9ms
13:22:53.866 DEBUG: GET 200 https://example.com/api/ce/task?id=AYE-URS3o9NiO9ce0vrw | time=12ms
13:22:58.871 DEBUG: GET 502 https://example.com/api/ce/task?id=AYE-URS3o9NiO9ce0vrw | time=5ms
13:22:58.899 DEBUG: eslint-bridge server will shutdown
13:23:04.549 DEBUG: stylelint-bridge server will shutdown
13:23:09.571 INFO: ------------------------------------------------------------------------
13:23:09.571 INFO: EXECUTION FAILURE
13:23:09.571 INFO: ------------------------------------------------------------------------
13:23:09.571 INFO: Total time: 12:09.000s
13:23:09.688 INFO: Final Memory: 14M/50M
13:23:09.688 INFO: ------------------------------------------------------------------------
13:23:09.689 ERROR: Error during SonarScanner execution
Failed to get CE Task status - HTTP code 502: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>

Related

How to handle "Re-run SonarQube Scanner using the -X switch to enable full debug logging" Error

We've suddenly got the SonarQube Error on CI/CD pipeline, Concourse. Since we had no change around sonar properties recently, totally confused what this error requires us.
Preparing SonarQube scanner...
Starting sonar-scanner (type: cli)...
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /tmp/build/put/sonar-input/sonar-project.properties
INFO: SonarQube Scanner 4.0.0.1744
INFO: Java 1.8.0_151 Oracle Corporation (64-bit)
INFO: Linux 4.15.0-159-generic amd64
INFO: User cache: /root/.sonar/cache
INFO: SonarQube server 7.9.1
INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
INFO: Sensor SurefireSensor [java] (done) | time=70ms
~
INFO: Sensor JavaXmlSensor [java]
INFO: Sensor JavaXmlSensor [java] (done) | time=3ms
INFO: Sensor HTML [web]
INFO: Sensor HTML [web] (done) | time=14ms
INFO: ------------- Run sensors on project
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=4ms
INFO: Sensor Java CPD Block Indexer
INFO: Sensor Java CPD Block Indexer (done) | time=81ms
INFO: 55 files had no CPD blocks
INFO: Calculating CPD for 44 files
INFO: CPD calculation finished
INFO: Analysis report generated in 91ms, dir size=696 KB
INFO: Analysis report compressed in 319ms, zip size=316 KB
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 18.928s
INFO: Final Memory: 32M/995M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: The 'report' parameter is missing
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
ERROR in /opt/resource/out : line 251 with exit code 2
Is there any way to handle this error...?
And just wondering it would be clear this issue if we would reboot the sonarqube docker.
Any adivise would be highly appreciated.
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
968xxxxxxx5b bitnami/sonarqube:7.9.1 "/app-entrypoint.sh …" 9 months ago Up 8 months 0.0.0.0:80->9000/tcp docker_sonarqube_1
Thanks to following discussion, we understood that caused by the lack of disk spaces. After clean-up, it worked fine in our case.
Error: The ‘report’ parameter is missing
https://community.sonarsource.com/t/error-the-report-parameter-is-missing/9616
– Faced similar issue, and found disk space issue on the server. Once clearing the disk space it worked.
Sonarqube : The 'report' parameter is missing
https://stackoverflow.com/questions/48805695/sonarqube-the-report-parameter-is-missing
--I just had the same problem here: my Linux server ran out of disk space and Sonarqube started to produce the report parameter is missing error. After deleting some unused files and restarting sonarqube, everything worked normal again

Gitlab job is successful despite assertion failure

I am running SoapUI assertions using maven image in gitlab. Even though the assertion fails the build is successful in gitlab. I have tried using mvn integration-tests -ff and as well as -fae but no luck. Also used allow_failure: false. This did not work either. Please advise as to how to fail the gitlab pipeline job if there is a failure in assertions.
Here is my yml file
T001-0011:
extends: .ETE -stage
image: adoptopenjdk/maven-openjdk11
variables:
MAVEN_CLI_OPTS: "--fail-fast"
script:
- 'mvn -f ./TV001/pom.xml $MAVEN_CLI_OPTS integration-test'
allow_failure: false
when: always
Here is the gitlab log
1 error
09:53:48,937 ERROR [SoapUITestCaseRunner] JDBC_Request failed, exporting to [/builds/gitlab/data/test-team-automation-scripts/./SV321/Warnings/target/surefire-reports/TestSuite_1-AC1-JDBC_Request-0-FAILED.txt]
09:53:48,938 INFO [SoapUITestCaseRunner] Finished running SoapUI testcase [AC1], time taken: 904ms, status: FAILED
09:53:48,953 INFO [SoapUITestCaseRunner] Running SoapUI testcase [AC2]
09:53:48,963 INFO [SoapUITestCaseRunner] running step [IDN220001-Request2]
09:53:48,966 DEBUG [HttpClientSupport$SoapUIHttpClient] Stale connection check
09:53:48,968 DEBUG [HttpClientSupport$SoapUIHttpClient] Attempt 1 to execute request
09:53:48,968 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Sending request: GET /apikey/v1/warnings/waning/IDN22000 HTTP/1.1
09:53:48,974 DEBUG [SoapUIMultiThreadedHttpConnectionManager$SoapUIDefaultClientConnection] Receiving response: HTTP/1.1 404 Not Found
09:53:48,975 DEBUG [HttpClientSupport$SoapUIHttpClient] Connection can be kept alive indefinitely
09:53:49,018 INFO [log] HTTP status code: 404
09:53:49,019 INFO [SoapUITestCaseRunner] Assertion [Valid HTTP Status Codes] has status UNKNOWN
09:53:49,019 INFO [SoapUITestCaseRunner] Assertion [Script Assertion] has status VALID
09:53:49,019 INFO [SoapUITestCaseRunner] Finished running SoapUI testcase [AC2], time taken: 8ms, status: FINISHED
09:53:49,021 INFO [SoapUITestCaseRunner] Project [DPD-3396] finished with status [FAILED] in 2591ms
SoapUI 5.3.0 TestCaseRunner Summary
-----------------------------
Time Taken: 2599ms
Total TestSuites: 1
Total TestCases: 2 (1 failed)
Total TestSteps: 3
Total Request Assertions: 5
Total Failed Assertions: 1
Total Exported Results: 3
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:03 min
[INFO] Finished at: 2022-06-15T09:53:54+10:00
[INFO] ------------------------------------------------------------------------
Cleaning up file based variables
00:01
Job succeeded
The mvn tests fail but the exit code that the command itself returns, probably is zero.
It is saying, I managed to run the tests.
But for you this doesn't help since you want to check the result of the tests.
Gitlab in order to fail a job checks the exit code of the commands used. You could force mvn to return an erroneous exit code when the tests fail
You could add the following flag
-Dmaven.test.failure.ignore=false

Sonarqube scanner cannot resolve relative file path in PHPUnit coverage XML file

When executing sonar-scanner with the example project available at:
https://github.com/SonarSource/sonar-examples/tree/b0ebd45081e58c3cb7c660287d5ed7fb9c64bb17/projects/languages/php/php-sonar-runner-unit-tests
I get the following warning, and the coverage data is not sent to the Sonar host:
WARN: Could not resolve 1 file paths in phpunit.coverage.xml, first unresolved path: src/Math.php
Full output of command:
root#46e4a60694f9:/home/test/sonar-examples-master/projects/languages/php/php-sonar-runner-unit-tests# /home/sonar-scanner-2.8/bin/sonar-scanner
INFO: Scanner configuration file: /home/sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/test/sonar-examples-master/projects/languages/php/php-sonar-runner-unit-tests/sonar-project.properties
INFO: SonarQube Scanner 2.8
INFO: Java 1.8.0_111 Oracle Corporation (64-bit)
INFO: Linux 4.4.27-boot2docker amd64
INFO: User cache: /root/.sonar/cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=240ms
INFO: User cache: /root/.sonar/cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=24ms
INFO: SonarQube server 6.1
INFO: Default locale: "en", source code encoding: "UTF-8"
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=141ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=55ms
INFO: Load active rules
INFO: Load active rules (done) | time=141ms
WARN: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
INFO: Publish mode
INFO: ------------- Scan PHP :: PHPUnit :: SonarQube Scanner
INFO: Language is forced to php
INFO: Load server rules
INFO: Load server rules (done) | time=76ms
INFO: Base dir: /home/test/sonar-examples-master/projects/languages/php/php-sonar-runner-unit-tests
INFO: Working dir: /home/test/sonar-examples-master/projects/languages/php/php-sonar-runner-unit-tests/.sonar
INFO: Source paths: src
INFO: Test paths: tests
INFO: Source encoding: UTF-8, default locale: en
INFO: Index files
INFO: 3 files indexed
INFO: Quality profile for php: Sonar way
INFO: Sensor Lines Sensor
INFO: Sensor Lines Sensor (done) | time=25ms
INFO: Sensor NoSonar Sensor
INFO: Sensor NoSonar Sensor (done) | time=65ms
INFO: Sensor SCM Sensor
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
INFO: Sensor SCM Sensor (done) | time=0ms
INFO: Sensor PHP sensor
INFO: 2 source files to be analyzed
INFO: 2/2 source files have been analyzed
INFO: Analyzing PHPUnit test report: reports/phpunit.xml with org.sonar.plugins.php.phpunit.PhpUnitResultParser#31ddd4a4
INFO: Analyzing PHPUnit unit test coverage report: reports/phpunit.coverage.xml with PHPUnit Unit Test Coverage Result Parser
WARN: Could not resolve 1 file paths in phpunit.coverage.xml, first unresolved path: src/Math.php
INFO: No PHPUnit integration test coverage report provided (see 'sonar.php.coverage.itReportPath' property)
INFO: No PHPUnit overall coverage report provided (see 'sonar.php.coverage.overallReportPath' property)
INFO: Sensor PHP sensor (done) | time=1419ms
INFO: Sensor Analyzer for "php.ini" files
INFO: Sensor Analyzer for "php.ini" files (done) | time=11ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=49ms
INFO: Sensor Code Colorizer Sensor
INFO: Sensor Code Colorizer Sensor (done) | time=1ms
INFO: Sensor CPD Block Indexer
INFO: DefaultCpdBlockIndexer is used for php
INFO: Sensor CPD Block Indexer (done) | time=2ms
INFO: Calculating CPD for 2 files
INFO: CPD calculation finished
INFO: Analysis report generated in 96ms, dir size=27 KB
INFO: Analysis reports compressed in 18ms, zip size=13 KB
INFO: Analysis report uploaded in 115ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://***.elasticbeanstalk.com/dashboard/index/org.sonarqube:php-ut-sq-scanner
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://***.elasticbeanstalk.com/api/ce/task?id=AVhaEXKjVjsdBlz4sGdU
INFO: Task total time: 3.511 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 5.098s
INFO: Final Memory: 42M/149M
INFO: ------------------------------------------------------------------------
When I change the path to absolute in the phpunit.coverage.xml, it seems to be working in Linux. On Windows docker quick start terminal (MINGW64) the only way to make it work is by using windows-style absolute paths:
C:\Users\username\projects\php-sonar-runner-unit-tests
Is there any way to make it work with relative paths?
Quoting from the README (on the same page that you linked):
In "reports/phpunit.coverage.xml", change the path "src/Math.php" to the full path of this file on your machine.
You must use the absolute path. It doesn't work with relative paths.
Note that this is just an example coverage report file, using one pre-generated by PHPUnit (also mentioned in the README). Normally you generate the coverage report file yourself before running SonarQube analysis, in which case it will have the correct absolute path in your system.

Error during Sonar-runner execution, Fail to download libraries from server

I'm trying to install SonarQube Runner.
I am using this versions:
sonarqube-5.1
sonar-runner-dist-2.4
mysql 5.1.63
jdk 1.7.0_79
ubuntu 11.4, 32 bits
I've already configured:
sonar/conf/sonar.properties
sonar-runner/conf/sonar-runner.properties
And created the project configuration file to analyze, in the directory of my project:
sonar-project.properties
The SonarQube is running correctly, I can corroborate doing:
service sonar status
If I run:
sonar-runner -X
I get the following error:
SonarQube Runner 2.4
Java 1.7.0_79 Oracle Corporation (32-bit)
Linux 2.6.38-8-generic i386
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: /opt/sonar-runner/conf/sonar-runner.properties
INFO: Project configuration file: /home/taller/taller2016/U3D_2016/sonar-project.properties
INFO: Default locale: "es_AR", source code encoding: "UTF-8"
INFO: Work directory: /home/taller/taller2016/U3D_2016/./.sonar
INFO: SonarQube Server 5.1
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.185s
Final Memory: 0M/53M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
java.lang.IllegalStateException: Fail to download libraries from server
at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:78)
at org.sonar.runner.impl.Jars.download(Jars.java:57)
at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:46)
at org.sonar.runner.impl.JarDownloader.checkVersionAndDownload(JarDownloader.java:37)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:71)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.io.IOException: Status returned by url : 'http://localhost:9002/sonar/batch_bootstrap/index' is invalid : 404
at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:94)
at org.sonar.runner.impl.Jars.dowloadFiles(Jars.java:64)
... 12 more
What do I need to do or change to solve it?
The access.log contains:
127.0.0.1 - - [06/oct/2016:16:17:34 -0300] "GET /sonar/api/server/version HTTP/1.1" 200 3 "-" "SonarQubeRunner/2.4"
127.0.0.1 - - [06/oct/2016:16:17:34 -0300] "GET /sonar/batch_bootstrap/index HTTP/1.1" 302 109 "-" "SonarQubeRunner/2.4"
127.0.0.1 - - [06/oct/2016:16:17:34 -0300] "GET /sonar/api/maintenance HTTP/1.1" 404 1045 "-" "SonarQubeRunner/2.4"
Thanks!
I found that the version of Java that was running on the server was 6, and this SonarQube needs Java 7. So, I upgraded the version of java. Then continued giving other errors, but droping the database and regenerating it, it worked correctly.
In my case it was too old SonarQube scanner(runner) version. Update to 4.x should fix the problem. See also https://community.sonarsource.com/t/error-during-sonarqube-scanner-execution-after-upgrade-to-sonarqube-8/17378/2.

SonarQube: No analysis retrieved

I tried to run a project.
The execution was successful but there seems to not have any analysis.
The log from the command prompt is as follow:
C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin>sonar-scanner.bat
C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\..
INFO: Scanner configuration file: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-sca
nner-2.6.1\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.8.0_102 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\kong-yong.tay\.sonar\cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=167ms
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.
INFO: User cache: C:\Users\kong-yong.tay\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=11ms
INFO: SonarQube server 5.6
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=173ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=87ms
INFO: Load active rules
INFO: Load active rules (done) | time=569ms
WARN: SCM provider autodetection failed. No SCM provider claims to support this
project. Please use sonar.scm.provider to define SCM of your project.
INFO: Publish mode
INFO: ------------- Scan Javascript Sonar Runner Simple
INFO: Language is forced to js
INFO: Load server rules
INFO: Load server rules (done) | time=325ms
INFO: Base dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin
INFO: Working dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\
.sonar
INFO: Source paths: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\p
rojects\languages\javascript\javascript-sonar-runner\src
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Index files
WARN: File 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\
languages\javascript\javascript-sonar-runner\src\Person.js' is ignored. It is no
t located in module basedir 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-
2.6.1\bin'.
INFO: 0 files indexed
INFO: Quality profile for js: Sonar way
INFO: JaCoCoSensor: JaCoCo report not found : C:\Users\kong-yong.tay\Desktop\Son
ar\sonar-scanner-2.6.1\bin\target\jacoco.exec
INFO: JaCoCoItSensor: JaCoCo IT report not found: C:\Users\kong-yong.tay\Desktop
\Sonar\sonar-scanner-2.6.1\bin\target\jacoco-it.exec
INFO: Sensor Lines Sensor
INFO: Sensor Lines Sensor (done) | time=0ms
INFO: Sensor SCM Sensor
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property
to explicitly specify it.
INFO: Sensor SCM Sensor (done) | time=2ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: Sensor Code Colorizer Sensor
INFO: Sensor Code Colorizer Sensor (done) | time=0ms
INFO: Sensor CPD Block Indexer
INFO: DefaultCpdBlockIndexer is used for js
INFO: Sensor CPD Block Indexer (done) | time=1ms
INFO: Calculating CPD for 0 files
INFO: CPD calculation finished
INFO: Analysis report generated in 72ms, dir size=11 KB
INFO: Analysis reports compressed in 14ms, zip size=4 KB
INFO: Analysis report uploaded in 86ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/
org.sonarqube:java-simple-sq-scanner
INFO: Note that you will be able to access the updated dashboard once the server
has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=A
VZ3vdRUAtopFvSq_-I1
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.071s
INFO: Final Memory: 47M/180M
INFO: ------------------------------------------------------------------------
It ran the first time (though without any analysis results but there was a log recorded in the database). However, for the subsequent time that I've ran the test, it has already stopped the connection to the database.
Please help.
You should run SonarQube Scanner in the directory where your project is located, not from where the Scanner is stored. In short (and in your case):
> cd C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\languages\javascript\javascript-sonar-runner
> C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\sonar-scanner.bat
Current situation
Currently you run it from:
INFO: Working dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\
But your code is in:
INFO: Source paths: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\languages\javascript\javascript-sonar-runner\src
And since you did not explicitely set sonar.projectBaseDir (see Analysis Parameters), you end up with this warning:
WARN: File 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\
languages\javascript\javascript-sonar-runner\src\Person.js' is ignored. It is no
t located in module basedir 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-
2.6.1\bin'.
INFO: 0 files indexed

Resources