I'm having problem running Sonar analysis through Jenkins. Using a Post Step with "Invoke Standalone Sonar Analysis" to start a Sonar Runner task. I can see the result from the analysis in the dashboard but the build in Jenkins never ends. It seems that the cleanup task in Sonar hangs. I am using H2 database and CANNOT change to other databases.
Jenkins is installed in Linux machine and is Sonar version is 3.7.4
How to resolve that clean snapshot hang part?
H2 database is not supported for production environments (but you seem to be aware of this fact). Furthermore, it is preventing you from upgrading to a recent version of SonarQube, since database migrations are not supported either on H2.
That being said, and if losing your project history is not important, you can try to switch to a recent SQ server and runner (respectively 4.4 and 2.4 as of writing), as there were quite a few improvements and bug fixes since last year.
H2 is not recommended for production as in sonar documentation stated. But if you are not awared of the history of sonar analysis, you can do the following (keep on using H2):
In Linux:
Stop sonar: service sonar stop
Delete sonar*.db under /opt/sonar/data
Start sonar again: service sonar start
Then run analysis again.
It should work, good luck.
Related
We are currently using GitLab and QuickBuild for our Android Projects.
I have to integrate Sonarqube to have a pre check before every build.
I'm not able to get much information for quickbuild as most of the documentation is for Jenkins.
I can see that we can create steps in quickbuild and I would have to add one more step for sonar check and execute the sonar command.
But still I'm not very sure what is the best practice?
Where should I run the Sonar Server?
Where to add the sonar configuration files?
Any good documentation available?
Should I run the Sonar check on GitLab or QuickBuild? (Our build server is QuickBuild so it looks the better option)
Ideally you should run sonar server on separate machine or you can use the same server on which quickbuild is running (depending upon java versions)
You can place sonar configuration file either in project directory or you can store it at any central location.
No official documentation for sonar and quickbuild integration.
Run sonar check on Buildserver.
We chose to do the SonarQube check inside the Maven build (that runs on Quickbuild). A Maven plugin is available. If you use Gradle, this might do as well.
I have a large application which uses gradle for its build, and jenkins for CI.
I upgraded gradle wrapper from version 2.4 to 3.4 recently. Every thing is ok in my development boxes, but 3 of test cases fail on the Jenkins box with NPE.
The NPE is caused by the fact that some records are not found in database. The records supposed to be inserted by dbunit.
We have thousands of test cases, following the same dbunit, pattern. None of them fail.
Does any one is aware of any change betwee gradle 2.4. to 3.4 that might cause this issue.
In my project we are using QC to execute our test cases(QTP), moving forward we would be eliminating QC (for cost reasons).
As far as I explored MSBuild & Jenkins, they would be suitable.
But MSBuild will trigger the execution when a new build pushed to the repository. Also it will automatically test on the latest build.
Is there any other CI tool available to execute test cases through QTP?
I will be executing automation once in a release. Also we install our application by manual since it requires lots of configuration.
Take a look at HP Application Automation Tools.
This plugin basically replaces the need for QC, and is developed by HP.
Create a Jenkins job using this plugin on the same Jenkins installation used to build your code, then you can configure your job to run your tests as soon the code is available (e.g. on a nightly basis).
See here for a helpful guide on how to implement a simple Jenkins job using this plugin.
They also host the code on Github, which is very useful if you need to change the behavior of the plugin to suit your needs.
I'm currently looking at how to start using SonarQube as part of a Jenkins build process for building mobile apps.
Because we are building mobile apps our Jenkins runs on OS X so we can support iOS.
We have a Sonar server running on a windows box elsewhere on the network so all we need to do from the OS X box is send the files that relate to the analysis.
What is the best way of doing that? Using the Sonar Runner jar? If so where is the best place to source that from?
EDIT
I should have added that we are using Jenkins Workflow in our build scripts, this means it isn't easy for us to use plugins that don't support the simple build step, as I believe Sonar doesn't.
This is why we really need information on how to do Sonar analysis from the command line.
EDIT
I appreciate that Sonar uses Java but I am definitely seeing different behaviour on OS X as opposed to Windows.
On Windows the Sonar Runner script works, whereas on OS X it times out, I'm able to verify it isn't a network issue since I can get to the Sonar server though the browser.
Regarding the OS, it's all Java code, so OS is a non-issue.
Regarding using Jenkins, take a look at SonarQube Scanner for Jenkins. It will let you configure your server information and add analysis as a Build Step to a job.
Short of that, you can run an analysis from the command line by installing SonarQube Scanner, cd-ing to your project root and invoking sonar-runner.
We were running a sonar server with an old version (3.4.1) with an embedded H2 database.
While migrating to an oracle databse we were upgrading our sonar server to the most recent version 3.6.2.
Upgrade finished successful (except it is not possible to keep the historical data). But after the upgrade was done sonar didn't show the code coverage any more.
Using the old sonar instance the coverage analysis still works. We did not change any sonar code coverage settings (leaving it to default: jacoco), just starting the analysis from within Jenkins via the Sonar plugin.
Did anyone had the same, a similar problem or any idea how to fix this?
Is there anything new, we have to configure?
In my case the value of sonar.java.coveragePlugin in sonar settings was set to cobertura, so it was just a wrong configuration.
Always keep in mind, that one can define global and project specific settings in sonar.