How to configure a continuous integration architecture at home? (2/3)

Initially published on August 4th, 2015

Last time, we went through the setup of the latest version of both Jenkins and SonarQube on a Synology Server. Although, the Synology214play is basically made for some personal usage, the concept behind this series of articles remains valid for any professional use. Indeed, it is possible to proactively safeguard his code delivery by implementing a continuous integration Platform almost free of charge.

Continuous Integration Architecture - Serverside

Ref. to the complete series:

Jenkins Plugin Management

More than 1000 plugins over 26 categories are presently available to customize Jenkins. The complete list is maintained under this Jenkins Wiki link. From my perspective, in order to avoid any side effects, start to update the plugins which are installed by default then select your SCM plugin (e.g., Git), SonarQube and eventually the LDAP plugin before configuring the system or managing security settings.

  1. Open the Jenkins Admin Console (by default, there is no security Policy): http://[MY_SERVER_IP]:7070/Jenkins,
  2. Click on “Manage Plugins”,
  3. Jenkins Plugin Management

  4. There you will first update the plugins already in place,
  5. Then, as per your convenience, you can install the following plugins:
    • Git Plugin,
    • Git Client Plugin,
    • LDAP Plugin,
    • SonarQube Plugin.
  6. Restart Jenkins.

Java SE, Maven & Jenkins

Once the plugins have been installed and the system has been relaunched, you will be able to configure the environment: SCM Tools, Java versions, Build tools, Plugins settings, …

  1. Go back to the Jenkins Admin Console then,
  2. Click on “Configure System”,
  3. Jenkins System Management

  4. Let’s Jenkins install automatically Java & Maven according to the version you are looking for (e.g., Java SE 8u51 & Maven 3.3.3) – those components will be selected when configuring a job,
  5. Java Settings

  6. In addition, in the Maven Configuration section, I personally use the default maven settings as default settings provider, the default maven global settings as default global settings provider. Finally, I define the workspace as local maven repository in the Maven Project Configuration section.
  7. Maven Settings

SonarQube & Jenkins

  1. In order to avoid having troubles with user privileges when running Sonnar Runner, I recommend to set up the variable SONAR_USER_HOME to point out to one of the Jenkins User Workspace (here my admin user). This path corresponds to the user workspace path JENKINS_HOME/user/[USR]. It will be used as a cache directory when running jobs.
  2. Configure SONAR_USER_HOME

  3. Then, select the appropriate SonarQube Runner version and let’s Jenkins install the SonarQube Runner,
  4. Configure SonarQube Runner

  5. Finally, configure SonarQube plugin itself with the settings we have set in the first part of this series:
  6. SonarQube account login/password = admin/admin,
    Database Login/password = sonarqube/initial and,
    Database url = jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance.

    Configure SonarQube

Securing Jenkins with LDAP Accesses

Assuming you have appropriately set up your LDAP server on Synology and you have imported your self signed certificate into the Java Keystore as explained in the first part of the serie, we will configure Jenkins to act as LDAP client.

  1. Open the Jenkins Admin Console then the configure the Global Security
  2. Configure Global Security in Jenkins

  3. Enable security by checking the flag then select the LDAP option:
  4. Enable Security in Jenkins

  5. Finally, create an account for each ldap user before assigning the appropriate authorizations.
  6. Configure Matrix-based Security

Job Definition

  1. From Jenkins landing page, create a new item then select either Freestyle or Maven Project depending on you POM file. Personally, I use to create Freestyle Projects.
  2. Enter a project name then check in the “Discard Old Builds” checkbox to optimize the job history settings.
  3. Discard old builds

  4. Maintain your Git Repository Address (it must point out to your “.git” file). Here, you can refer to this article to understand the following Git Settings:
  5. Configure Git workspace

  6. Define the build frequency as per your convenience. You want to apply.
  7. Schedule builds

  8. Invoke your Maven targets.
  9. Define Maven targets

  10. Finally, append one standalone SonarQube Analysis to your build that you can configure as following:
  11. Invoke standalone SonarQube Analysis

From the Jenkins perspective, you are ready to start your first build.

Install SonarQube Plugins

At this stage, SonarQube must be up and running and accessible via port 9000 and admin credentials.

  1. Logon with admin credentials then click on the “Settings” tab. Go to “Systems”, “Update Center” then “Available Plugins” to select the following plugins.
  2. SonarQube Plugins

  3. Restart SonarQube then test your configuration by launching your first build from Jenkins. Have fun!

Further readings?

About the author

Freelancer, IT Architect and Program Manager, Ludovic Fernandez is specialized in designing and realizing innovative and reliable enterprise applications.

Feel free to refer to this page on