Promoting Sonar configuration from staging to production environment

As you use Sonar more and more, it becomes the central place for code quality management. The result of every analysis goes to the database and adds to the precious history of data. You are now relying so much on Sonar that you want to protect your measures .

Since you still want to test new coding rules, different parametrization, add alerts or try a new plugin in Sonar… it is time to create a sand box to try all that. But how to then apply the changes to your production environment without having to duplicate the work already done ? Here is how to do it in 7 steps :

1. Stop the production server

2. Backup the production database

3. Copy the possible plugins from sand box onto the /extensions/plugins directory in production

4. Copy the possible custom coding rules from sand box onto the /extensions/rules directory in production

5. Re-start the production server

6. Export the sand box Sonar’s configuration. To do so, sign in on the sand box Sonar environment, go to configuration and select the Backup / Restore entry in the left menu. Click on Backup and save the file.

backup

7. Import the configuration onto production. To do so, sign in on the production Sonar environment, go to configuration and select the Backup / Restore entry in the left menu. Click on Browse to select the backup file and press restore.

restore

The promotion process is completed ! As this process is quite straightforward, there is no more need to play with your Sonar production environment and your historical measures are now safe.

Using quality profiles in Sonar

Last month, Sonar 1.6 was released. The main feature of the new version is the ability to manage quality profiles. The purpose of this post is to explain what gap the functionality fills, to define what is a quality profile and to explain how to use it.
Prior to Sonar 1.6, it was only possible to run analysis with one set of defined coding rules per instance of Sonar. It means that within an instance of Sonar, it was not possible to process differently various types of projects (legacy application, technical libraries, new projects, …). They were all analyzed with the same set of rules. Therefore there was sometimes unnecessary noise around the quality data that made it difficult to see quickly what real action was required. Sonar 1.6 turns off this noise by allowing to define and simultaneously use several quality profiles.

Read the rest of this page »