Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Blueriq Model Analyzer consists out of three components: Blueriq Sonar Plugin, Blueriq Quality Gate, Blueriq Sonar Scanner. Only the Blueriq Sonar Plugin and the Blueriq Quality Gate have to installed before being analyzing your Blueriq Models. The Blueriq Sonar Scanner is used to execute the analysis and therefor has to be made available on the environment from where you want to execute the analysis of you Blueriq Models.

Table of Contents

Installation requirements

All of the components require the Java to be available on the environment from where the components are ran. You can either install Java with a Java Installer, which makes Java globally available on your environment, or you can extract Java to a specific directory. This installation guide will provide information for both options. Make sure you download the correct Java version (32/64bit). See the Blueriq Model Analyzer Platform Support page which version of Java is support for your Blueriq Model Analyzer version.

Blueriq Sonar Plugin

The Blueriq Sonar Plugin is a plugin for SonarQube, which performs the analysis on your Blueriq Models created in the Blueriq Studio. The Blueriq Sonar Plugin needs to be placed inside a SonarQube instance. This installation guide will provide information on how to install SonarQube and how to place the Blueriq Sonar Plugin in the correct directory of Sonarqube so it becomes available.

Installing Sonarqube

Download SonarQube from https

Install requirements

Install Java

Java needs to be installed on the machine on which analysis will be carried out. To make sure Java is installed on your machine, you can open a command prompt and type

java –version 

If Java is installed you will be prompted with the installed Java version, like this:

Image Removed

If Java is not installed on your machine, you can download it from https://java.com/nl/download/  and follow instructions  from there.

Install Sonarqube

SonarQube can be downloaded from http://www.sonarqube.org/downloads/.

Select the supported version mentioned in Blueriq Model Analyzer Platform Support, and store it on your machine. Unzip the downloaded zip-file to the destination folder directory of your choice. The contents of the unzipped folder directory should look like this:

Image Removed

Install Maven

Apache Maven can be downloaded from https://maven.apache.org/download.cgi

Select the download of your choice, and store it on your machine. Then, unzip the downloaded zip-file to the destination folder of your choice. The contents of the unzipped folder should look like this:

Image Removed

Add maven to path

to be able to run sonarqube analysis you need to add maven to your path. This is done by opening a command prompt window in administrator mode and typing the following command:

Code Block
languagevb
themeMidnight
titleAdministrator: Command Prompt
setx path "%path%;<maven installation location>\bin"

Install Blueriq Model Analyzer for Sonarqube

Image Added

Info
titleConfiguring Java

If you do not have Java globally available on your system, you will need to set the path to the installation directory of Java. This can be done by editing the wrapper.conf file which is located in the conf directory of your SonarQube installation directory. 

Below is an example of how the wrapper.conf should look when you Java installation directory is located here: C:\Program Files\Java\jdk-11.0.2

Code Block
languagetext
titlewrapper.conf
# Path to JVM executable. By default it must be available in PATH.
# Can be an absolute path, for example:
#wrapper.java.command=/path/to/my/jdk/bin/java
wrapper.java.command=C:/Program Files/Java/jdk-11.0.2/bin/java

...

Installing Blueriq Sonar Plugin in Sonarqube

The Blueriq Sonar Plugin The Blueriq Model Analyzer plugin called bma-sonar-plugin.jar needs to be placed inside the SonarQube directory in installation directory of SonarQube. Navigate to the subdirectory called extensions/plugin, for instance /sonarqube-5.6.6/extensions/pluginsplugins inside the installation directory of SonarQube, and copy the bma-sonar-plugin.jar into the subdirectory.

Note

Only copy the bma-sonar-plugin

Note

Do not copy bma-qualitygate-installer-#.jar to extensions/plugin. This will prevent SonarQube from starting up.

After installation

plugins. If any non SonarQube plugin jars are placed into the extensions/plugins directory, Sonarqube will not start.

Running SonarQube

When the Blueriq Sonar Plugin When the Blueriq Model Analyzer plugin is in place, start the SonarQube service by running the StartSonar.bat in the subdirectory of the bin folder directory corresponding to your operating system. For instance /sonarqube-5.6.6/bin/windows-x86-x64

Configure Maven POM file

Finally, Maven and SonarQube need to be configured with the correct properties to be able to read your Blueriq Model of interest. Maven takes care of this by reading a pom.xml file.

Tip
titleSetting up configuration

Setting up a default configuration can be done through the SonarQube administration options. We have some suggestions for Setup in an enterprise landscape.

You will have to create the pom.xml yourself, and then configure it for your own Blueriq installation, repository, branch and project(s).

Below, you can find

  • An example of a pom.xml
  • The location where to save the pom.xml
  • An explanation of the properties in the pom.xml

An example configuration in this pom file looks like this:

Code Block
languagexml
titleExample
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>SingleModule</groupId>
  <artifactId>singlemodule-test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>SingleModuleTest</name>
  
    <properties>
        <sonar.blueriq.managementservice>http://my-studio-server/Studio/Server/Services/ManagementService</sonar.blueriq.managementservice>
        <sonar.blueriq.repository>RubikTest</sonar.blueriq.repository>
        <sonar.blueriq.branch>Trunk</sonar.blueriq.branch>
        <sonar.blueriq.projects>Kinderbijslag,TestProject</sonar.blueriq.projects>
        <sonar.blueriq.username>admin</sonar.blueriq.username>
        <sonar.blueriq.password>welcome</sonar.blueriq.password>
        <sonar.blueriq.authentication>BASIC</sonar.blueriq.authentication>
        <sonar.blueriq.skipanalysis>false</sonar.blueriq.skipanalysis>
        <sonar.blueriq.workingDir>target/bq</sonar.blueriq.workingDir>
    </properties>
</project>

...

Image Removed

The properties in the pom file:

...

sonar.blueriq.managementservice

...

Url to the management service, if this property is set then all other managementservice properties must also be set. If this is not set, then the branchexportlocation must be set.

...

sonar.blueriq.repository

...

Name of the repository.

...

sonar.blueriq.branch

...

Name of the branch.

...

sonar.blueriq.username

...

Studio username credential.

...

sonar.blueriq.password

...

Studio password credential.

...

Logging in in SonarQube

To proceed you have to login in SonarQube, which by default is available at localhost:9000. An Administrator can manage tokens on a user's behalf via Administration > Security > Users

When installing SonarQube, a default user with Administer System permission is created automatically:

  • Login: admin
  • Password: admin

Adding a license

In SonarQube, go to Administration → Blueriq, and put the content of your license.aql file into the license textbox.
It is also possible to include the license key in the application.properties of the BMA (see also: Configuring Sonar Scanner).

Blueriq Quality Gate
Anchor
blueriq_quality_gate
blueriq_quality_gate

The Blueriq Quality Gate is a SonarQube Quality Gate, more information about quality gates can be found here.

Adding Blueriq Quality Gate

The Blueriq Quality Gate called bma-qualitygate-installer.jar can be runned by using java -jar bma-qualitygate-installer.jar. When running this command you will be prompted with several questions.

Prompt

Input

hostnameThe url to your SonarQube instance. This should be either yoururl.here[:PORT] or http[s]://yoururl.here[:PORT]/
usernameA username for a user with the Administer Quality Gates permission. (default: admin)
passwordThe password for the above mentioned user. (default: admin)

Clean install? (y/n)

Decide whether to delete the current quality gate and overwrite it with a new one. If the answer is not "Y", the script will only install missing conditions.

Image Added

Info
titlecommand line arguments

It is possible pass command line arguments into the bma-qualitygate-installer.jar for information see Quality Gate Installer

During the installation of the Blueriq Quality Gate you will be informed of the progress. After the Quality Gate installation is finished, you can verify that the Blueriq Quality Gate is present in SonarQube. This can be done by navigating to the Quality Gates tab in SonarQube.

Blueriq Sonar Scanner

The Blueriq Sonar Scanner is a SonarQube Scanner, which is a tools to analyze your projects. For Blueriq we have introduced our own Blueriq Sonar Scanner, due to implications we cannot provide an analysis using the default SonarQube Scanners. The Blueriq Sonar Scanner is a Spring Boot Java Command Line Interface runner, which can be used to execute the analysis of your Blueriq Models.

Where to place the Sonar Scanner

Commonly a quality analysis is performed on Continuous Integration(CI) Servers like for instance Jenkins. With older versions of the Blueriq Model Analyzer it was possible to use the Maven Sonar Scanner to execute an analysis, and therefor only a connection to a central maven repository had to be setup. From the Blueriq Model Analyzer version 3 or higher you will need to place the Blueriq Sonar Scanner called bma-sonar-scanner.jar on the environment you which to execute the analysis from. 

For example if you want to execute an analysis on your CI Server, you will need to place the bma-sonar-scanner.jar somewhere on the system of your CI Server. If you want to execute an analysis on locally on your own environment, you will need to place the bma-sonar-scanner.jar somewhere on your local environment. 

Performing an Analysis

See the User documentation on how to execute an analysis of your Blueriq Models.

Enforcing the Quality Gate in a Jenkins pipeline

To enforce the Quality Gate in Jenkins you can use the SonarQube Scanner plugin. To configure the BMA you can follow the provided example configuration of this plugin. The only way the BMA configuration deviates from this example is in the way it triggers the analysis.

Instead of using the "sh "mvn clean package sonar:sonar"" command, use the "java -jar  <location on disk>\bma-sonar-scanner.jar" command to trigger the analysis.

It may occur that after the analysis stage, SonarQube needs some time to process the results while Jenkins already proceeds to the Quality Gate stage. It could therefore be useful to add a wait step.

Example pipeline:

Code Block
pipeline {
        agent none
        stages {
          stage("BMA SonarQube analysis") {
            agent any
            steps {
              withSonarQubeEnv('My SonarQube Server') {
                java -Dspring.config.location=file:C:\bma\application.properties -jar C:\bma\bma-sonar-scanner.jar
              }
            }
          }
          stage("Quality Gate") {
            steps {
              timeout(time: 1, unit: 'HOURS') {
                waitForQualityGate abortPipeline: true
              }
            }
          }
        }
      }

...

sonar.blueriq.projects

...

A comma separated list of blueriq project names.

...

Set to true if the BMA plugin shouldn't be triggered for the current project. This is useful when scanning projects without Blueriq, or when no connection can be made to the management service.

The following properties are default SonarQube properties. More information can be found here.

...

sonar.host.url

...

localhost:9000

...

Url and port to the sonarQube host.

...