Installs and configures SonarQube server and the SonarQube Scanner. Provides a LWRP for for installing SonarQube plugins.
- CentOS
- Ubuntu
Tested on:
- CentOS 6.4
- Ubuntu 12.04
SonarQube requires JDK 1.7 or later. Use the Java Cookbook to install a suitable Oracle JDK or OpenJDK.
Installs SonarQube Server and manages sonar.properties
.
Installs SonarQube Scanner and manages sonar-runner.properties
.
Adds the SonarQube Scanner to all users' PATH
via /etc/profile.d
.
This LWRP manages SonarQube plugins.
The :install
action installs a SonarQube plugin to an existing SonarQube Server instance.
Plugins are retrieved from
SonarSource's distribution mirror.
The plugin version must be specifed.
# Installs version 1.3 of the SonarQube Groovy plugin
sonarqube_plugin 'groovy' do
version 1.3
end
The :uninstall
action removes a SonarQube plugin.
sonarqube_plugin 'groovy' do
version 1.3
action :uninstall
end
On systems that should be SonarQube servers, add recipe[sonarqube]
to the runlist.
By default, the SonarQube server will connect to an embedded H2 database. To connect to a different database, override:
node['sonarqube']['jdbc']['username']
node['sonarqube']['jdbc']['password']
node['sonarqube']['jdbc']['url']
On systems that need to invoke SonarQube analyses against an existing SonarQube Server
(such as a CI machine), add recipe[sonarqube::scanner]
to the runlist.
By default, the SonarQube Scanner will search for a SonarQube server running on localhost:9000
.
To connect to a different SonarQube Server, override:
node['sonarqube']['scanner']['host']['url']
If the SonarQube Server prohibits anonymous users from executing analyses, also override:
node['sonarqube']['scanner']['host']['username']
node['sonarqube']['scanner']['host']['password']
Browse the attributes
directory to view advanced attributes.
- Does not run
apt::default
on Ubuntu- add
apt::default
to your run list before anything else if you need it (e.g. for the Java installation as described in the previous bullet)
- add
- ChefDK
- Recent RuboCop
chef gem install rubocop
Test changes using:
chef exec rake
chef exec kitchen verify
chef exec knife cookbook site share sonarqube "Monitoring & Trending"
Christian Willman github@willman.io
MIT