ERROR: Error during SonarQube Scanner execution - jenkins

I have configured Jenkins Job for Sonar Quality Gate and Code Coverage. Below is the Jenkins job set Up. When I trigger the build I see below error. Most of my Jenkins jobs are failing because of this issue. Please help me out from this.
Jenkins Job setup
Error Logs
ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Error at line 2 of coverage report C:\Location.xml
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.loadReport(GenericCoverageSensor.java:130)
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.analyseWithLogger(GenericCoverageSensor.java:95)
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.analyse(GenericCoverageSensor.java:91)
at org.sonar.plugins.coverage.generic.ReportParser.parse(ReportParser.java:82)
at org.sonar.plugins.coverage.generic.GenericCoverageSensor.loadReport(GenericCoverageSensor.java:126)
... 31 more
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
The SonarQube Scanner did not complete successfully
21:44:09.12 Creating a summary markdown file...
21:44:09.122 Post-processing failed. Exit code: 1

The answer is there in the log:
org.sonar.plugins.dotnet.tests.ParseErrorException: Missing root element 'test-results' in C:\UC\ProductEligibility\BTS\results.xml at line 2
So the results.xml is not valid xml and causes a parse error and kills the analysis. So whatever creates that file, is causing the issue in the end.
Try to remove that parameter to verify if the analysis runs correctly now.

Related

Sonar-Gerrit integration shows error in Jenkins

There is a Jenkins freestyle job that is triggered by some Gerrit events.In response to triggers, it downloads the changes and runs a Sonarqube Analysis. The Sonarqube comments detailing the results are to be posted on Gerrit after the analysis is complete.This is the expected behaviour.
As of now, In Jenkins, the Sonarqube execution is success. But the build is failed mentioning the error " *ERROR: Build step failed with exception java.lang.IllegalArgumentException: Gerrit change number is empty*
Could anyone please help on this?
Reference:https://plugins.jenkins.io/sonar-gerrit/
Followed the same steps as mentioned in the above document.
Jenkins console output
Expected: The Sonarqube should post the comments to the respective Gerrit change,whether the Sonar-verified is +1/-1.

Jenkins pipeline to call SonarQube code coverage for node.js project

I am trying to do code coverage for node js project via Jenkins, I’ve one doubt that where to add the “sonar-project.properties” file, it in root repository that means in sonar-scanner installed repository or in the jenkins path i.e. “/var/lib/jenkins/workspace/$JOB_NAME/”,
can some help to fix this I’m getting error while executing the pipeline.
Error log as follows:
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/sonardemo/bin/sonar-scanner
/var/lib/jenkins/workspace/demosonar#tmp/durable-f32cf5e2/script.sh: 1: /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/sonardemo/bin/sonar-scanner: not found
[Pipeline] }
WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?

Jenkins build is getting succeed even though Response Assertion fails

I am using Jmeter for API's functional testing. For this, have added Response Assertion.
Even though it's failing but Jenkin's build appeared as Succeed.
Is there any way to mark Jenkin build as Failed when our Assertions are failed?
Please help out on this, let me know if any more info is required.
It depends on how do you launch JMeter in Jenkins, if it's just a command-line non-GUI execution like jmeter -n -t test.jmx -l result.jtl then it doesn't produce any error exit status code and this is something Jenkins checks.
The options are in:
Migrating to JMeter Maven Plugin which provides jmeter-check-results goal
Migrating to Taurus which provides Pass/Fail Criteria subsystem
And finally you can add a JSR223 Listener to your Test Plan and force JMeter to exit by adding the next code in the "Script" area:
if (!prev.isSuccessful()) {
System.exit(1)
}

When I am running Execute SonarQube Scanner on Jenkins, job always fails

I am running Execute SonarQube Scanner on Jenkins, but the job always fails.
The job log shows:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:
sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project
helpRequestMgmtUI: Not authorized. Please check the properties
sonar.login and sonar.password. -> [Help 1]
In job configuration, I added the following into Analysis properties:
sonar.projectKey=org.sonarqube:javascript-lcov-sq-scanner
sonar.projectName=My project
sonar.projectVersion=1.0
sonar.language=js
sonar.sources=webapp
sonar.sourceEncoding=UTF-8
sonar.javascript.coveragePlugin=jacoco
sonar.login=admin
sonar.password=admin
In the last two lines I have already added user name and password but it does not work for executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603
However, the SonarQube dashboard is created successfully.
How do I avoid this authorization exception, when analysing my project?

"Unable to find build script" error running Ant from Jenkins

I got this error when running Jenkins to build an Ant project. Could someone explain the source of the problem and how to fix it?
ERROR: Unable to find build script at D:\WORK\06_HRMS\90_SourceCode\trunk\jwf
Recording test results
Injecting SonarQube environment variables using the configuration: Sonar
ERROR: Step ‘Publish JUnit test result report’ aborted due to exception:
java.io.IOException: Failed to read /var/lib/jenkins/workspace/MBFS/lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
Is this really a JUnit report file? Your configuration must be matching too many files

Resources