Error while executing the rcov report, rails stats report and brakeman warnings from Jenkins - ruby-on-rails

I am using Jenkins for deployment process and it works fine. When i try to take rcov report rails stats report and brakeman warnings.
[ubuntu#xx.xxx.xxx.xx] executing command
** [out :: ubuntu#xx.xxx.xxx.xx] Starting Unicorn..
command finished in 2228ms
POST BUILD TASK : SUCCESS
END OF POST BUILD TASK : 0
ERROR: Publisher hudson.plugins.brakeman.BrakemanPublisher aborted due to exception
java.io.FileNotFoundException: /home/kannan/.jenkins/workspace/Publisher Dev/brakeman-output.tabs (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at hudson.FilePath.read(FilePath.java:1570)
at hudson.FilePath.readToString(FilePath.java:1595)
at hudson.plugins.brakeman.BrakemanPublisher.perform(BrakemanPublisher.java:99)
at hudson.plugins.analysis.core.HealthAwarePublisher.perform(HealthAwarePublisher.java:146)
at hudson.plugins.analysis.core.HealthAwareRecorder.perform(HealthAwareRecorder.java:331)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:726)
at hudson.model.Run.execute(Run.java:1618)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:247)
Publishing rails stats report...
Build failed, skipping rcov coverage report
Build step 'Publish Rcov report' marked build as failure
Finished: FAILURE
What am i supposed to do

Look at the error:
java.io.FileNotFoundException: /home/kannan/.jenkins/workspace/Publisher Dev/brakeman-output.tabs (No such file or directory)
This means Jenkins can't find the report generated by Brakeman. Either you have not set up the job correctly or Brakeman is failing for some reason. You should check the console output for Brakeman errors and verify you have configured the job correctly as described here.

Related

How to Find Out What Version of JUnit Jenkins is Expecting

I am trying to configure my Jenkins project to display the results of a JUnit XML report. However, the Jenkins project throws the below error when trying to display the JUnit XML during the build.
Recording test results
ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
java.lang.NoClassDefFoundError: hudson/tasks/junit/JUnitParser$ParseResultCallable
at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:90)
at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:120)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:137)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:74)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1765)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Finished: FAILURE
I have read that this error is possibly due to a mismatch between the JUnit version Jenkins is expecting and the version used by my project. How do I find out which version of JUnit Jenkins is expecting? Also, is there anything else that could cause the above error?
Error is thrown by JUnitResultArchiver. It is a dependency of Junit plugin. Go into the Jenkins and look for the version of JUnit Plugin.Then look at source code of that particular version on project's github: https://github.com/jenkinsci/junit-plugin
After doing that, you will have the exact version that it requires.
Another reason why you are seeing this error is that you have a different compile and runtime classpaths.

Allure: Jenkins Plugin is not able to generate report

Could you please help with the follow?
Running the protractor test.
Jenkins plugin is not able to generate report.
Error: 404 not found.
Allure plugin: 2.19
Allure commandline: 1.54
Protractor: 5.1.2
Jenkins is run locally: 2.60.1
NodeJS: 6.9.4
NPM: 4.0.5
Error stack trace: allure-report for the report is already in use, add a '--clean' option to overwrite.
Stack trace:
[11:56:19] I/launcher - 0 instance(s) of WebDriver still running
[11:56:19] I/launcher - chrome #01 failed 1 test(s)
[11:56:19] I/launcher - overall: 1 failed spec(s)
[11:56:19] E/launcher - Process exited with error code 1
npm ERR! Test failed. See above for more details.
Build step 'Execute Windows batch command' marked build as failure
[protractor-allure-reporting-example] $ D:\Jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure-commandline\allure-2.2.1\bin\allure.bat generate
D:\Jenkins\workspace\protractor-allure-reporting-example\first-result -o
D:\Jenkins\workspace\protractor-allure-reporting-example\allure-report
Allure: Target directory D:\Jenkins\workspace\protractor-allure-reporting-
example\allure-report for the report is already in use, add a '--clean' option to overwrite
ERROR: Build step failed with exception ru.yandex.qatools.allure.jenkins.exception.AllurePluginException: Can not generate Allure Report, exit code: 1
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.generateReport(AllureReportPublisher.java:173)
at ru.yandex.qatools.allure.jenkins.AllureReportPublisher.perform(AllureReportPublisher.java:94)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:81)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:735)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:676)
at hudson.model.Build$BuildExecution.post2(Build.java:186)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:621)
at hudson.model.Run.execute(Run.java:1760)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:405)
Build step 'Allure Report' marked build as failure
Finished: FAILURE
Seems like you need to clean your workspace before build. Or you can add one more step before report generation that will remove allure-report directory.
Add it in package.json scripts
"posttest": "allure generate allure-results --clean -o allure-report || true && allure report open -o allure-report"
try to check that in the docker container where your allure report generated not able to detect java_home. So try to set your report path where your container ends and then your allure report will able to find java_home.
and able to generate report.
Use below command to check the same:
sh "/var/lib/.../ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/../bin/allure --version"

Jenkins CI: 'NumberFormatException: empty String'

We have a Jenkins installation and some projects which are tested by NUnit. This works fine and it writes an NUnit results XML file.
Then we have a 'Publish NUnit test result report' post-build step. But since friday it produces this error:
Recording NUnit tests results
ERROR: Step ‘Publish NUnit test result report’ aborted due to exception:
java.io.IOException: remote file operation failed: C:\Jenkins\workspace\xxx at hudson.remoting.Channel#205d5d5c:CIAgent: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
at hudson.FilePath.act(FilePath.java:986)
at hudson.FilePath.act(FilePath.java:968)
at hudson.plugins.nunit.NUnitPublisher.getTestResult(NUnitPublisher.java:226)
[...]
Caused by: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
at hudson.tasks.junit.TestResult.parse(TestResult.java:306)
at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244)
at hudson.tasks.junit.TestResult.parse(TestResult.java:175)
[...]
... 13 more
Caused by: java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
at java.lang.Float.parseFloat(Unknown Source)
[...]
Archiving artifacts
Finished: FAILURE
The XML file is present in the working directory. I mentioned that the first line of this file looks like this:
<?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="xxx_Tests.TestsWithRealServers.TestWithTwoLocals" skipped="6" tests="6" time="">
So I guess it fails because the time attribe is empty.
Does anyone how I can fix this or why this error occurs?
Thanks!
Did you recently upgrade the jenkins JUnit plugin to 1.12? There is a reported issue in this update. You might try downgrading back to 1.11.
By the way, Jenkins plugins does not support Nunit 3 XML format. I also had a similar problem on Jenkins. I used to convert Nunit 3 result format to Nunit 2 format.
"C:\NUnit 3.5.0\nunit3-console.exe" /result:\MyApplication.xml;format=nunit2 "D:\Jenkins\workspace\MyApplication.Tests.dll"

Jenkins Ruby metrics plugin fail to copy .gitkeep

Jenkins Ruby metrics plugin cause error when copy .gitkeep file to log directory, because it fails to create log directory.
Error message is below.
Publishing rcov report...
ERROR: Publisher hudson.plugins.rubyMetrics.rcov.RcovPublisher aborted due to exception
Failed to copy /Users/Shared/Jenkins/Home/jobs/RailsApp/workspace/log/.gitkeep to /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep due to failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:914)
at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:567)
at hudson.Util.copyFile(Util.java:922)
at hudson.FilePath$38$1.visit(FilePath.java:1937)
at hudson.util.DirScanner.scanSingle(DirScanner.java:49)
at hudson.util.DirScanner$Glob.scan(DirScanner.java:131)
at hudson.FilePath$38.invoke(FilePath.java:1932)
at hudson.FilePath$38.invoke(FilePath.java:1925)
at hudson.FilePath.act(FilePath.java:914)
at hudson.FilePath.act(FilePath.java:887)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1925)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1911)
at hudson.FilePath.copyRecursiveTo(FilePath.java:1894)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:28)
at hudson.plugins.rubyMetrics.Utils.moveReportsToBuildRootDir(Utils.java:12)
at hudson.plugins.rubyMetrics.HtmlPublisher.prepareMetricsReportBeforeParse(HtmlPublisher.java:30)
at hudson.plugins.rubyMetrics.rcov.RcovPublisher.perform(RcovPublisher.java:50)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:784)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:756)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:705)
at hudson.model.Run.execute(Run.java:1695)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
Caused by: java.io.IOException: failed to create the parent directory for /Users/Shared/Jenkins/Home/jobs/RailsApp/builds/2014-02-05_21-07-52/log/.gitkeep
at org.apache.tools.ant.util.ResourceUtils.copyResource(ResourceUtils.java:512)
at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:559)
at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:899)
... 25 more
Jenkins didn't create log 'directory' but log 'file'. Jenkins have permission to read/write of the directory of course. Any ideas? Thanks in advance.
I spend a lot of time to fix this issue.
In fact, when you activate the Ruby metrics plugin, you have to provide a directory. If you don't, the default folder is log, and it is the cause of your error.
So, go to your project configuration and in the Publish Rcov Report section, you just fill the directory.
Enjoy :)

Adding Post-build Actions Sonar causes Jenkins build to fail

Using Jenkins ver. 1.494; Jenkins Sonar Plugin 2.0.1; Sonar server 3.4.1.
Maven job.
Adding Post-build Actions Sonar causes Jenkins build to fail (ERROR: Failed to parse POMs).
Deleting Sonar action then again makes it pass.
Sync complete, took 35 ms
Parsing POMs
[Atlas_Phevos] $ java -Xmx512m -XX:MaxPermSize=128m -cp /home/jenkins/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/home/jenkins/jenkins-home/tools/Maven/Maven304/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /home/jenkins/jenkins-home/tools/Maven/Maven304 /usr/local/tomcat-6.0.32/webapps/jenkins/WEB-INF/lib/remoting-2.19.jar /home/jenkins/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 60147
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "java" (in directory "/home/jenkins/jenkins-home/workspace/Atlas_Phevos"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:763)
at hudson.Launcher$ProcStarter.start(Launcher.java:353)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:223)
at hudson.maven.ProcessCache.get(ProcessCache.java:231)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:670)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
at hudson.model.Run.execute(Run.java:1543)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 12 more
Skipping sonar analysis due to bad build status FAILURE
Sending e-mails to: ____
Finished: FAILURE
I haven't put updated setting.xml on Jenkins server, I guess Jenkins should take its own configuration for Sonar (sever, JDBC connection etc.)
UPDATE: Problem still exists. I tried several jobs to start sonar analysis.
From your exception it looks like Jenkins cannot find your JDK. In your job configuration you can expand the Sonar properties. Make sure that a valid JDK from your Jenkins config is selected under the JDK option.
While you are looking at the properties make sure the pom file specified under Root POM is correct.
Try that...

Resources