Jenkins-Sonar communication on Openshift Jenkins-Sonar communication on Openshift jenkins jenkins

Jenkins-Sonar communication on Openshift


I finally succeeded on making my Jenkins gear send data to my Sonar gear !

I'll explain the solution I found here, maybe it will help some people.

There a three ways to access an Openshift database:

  1. The gear that contains that database can access it easily on localhost:3306. That's the usual case.
  2. From your own computer, you can bind ports (with the rhc tool) in order to access the database. This can't be applied from another gear, and requires the rhc tool to keep running.
  3. Any gear from your account can access the database of a scalable application.

Usage:

When creating the Sonar gear, it's necessary to set the gear as scalable (this can't be done with jenkins/diy gears). Adding a database cartridge to this gear will consume 1 gear, but this database can be accessed from any Openshift application.

Notice that this new database will have a port different than 3306 (in my case, 39536). If you don't have this, that's probably that the embedded app isn't set scalable.

The Jenkins job script that I put in my question is correct. Changing all these "xxxxx" and the port with your database info will permit Jenkins to do his job !