This repository contain base configuration files and js scripts for automatic configuration implementation on VirtoCommerce SonarQube servers. Scripts and configuration files can be applied on a new SonarQube installation to configure the server in accordance with the VirtoCommerce quality requirements.
- gates.json - SonarQube quality gates configuration file
- exclusions.json - projects file paths or files are excluded from the analysis
- virtoCssProfile.xml - custom CSS profile backup
- virtoTypeScriptProfile.xml - custom TypeScript profile backup
- groups.json - custom user groups and permissions
To apply the settings on the new SonarQube installation standard SonarQube API used. For configuration applying, js scripts are created that read configuration files and call the corresponding SonarQube API to apply the settings.
connectionOptions.js contain options, http objects and url const. Options describe SonarQube connection parameters, http - "transport protocol" module could be http or https (if you use https dont forget set actual options.port value, usually 443) url - connection string name to the server.
const http = require('http');
const url = 'localhost';
var options = {
auth: 'admin:admin',
hostname: url,
port: 9000,
path: '/',
method: 'POST'
};
Before scripts execution, fill in with your parameters
- http - your transport protocol http or https
- url - your server url or IP
- options.auth - login:password your SonarQube admin user
- options.port your SonarQube port
To use the configuration correctly, run the js scripts in the following sequence:
- createExclusions.js - exclude file paths or file from quality analysis (to run, type in terminal node createExclusions.js)
- createGates.js - create Red, Orange, Green, Blue quality gates, set Green as default (to run, type in terminal node createGates.js)
- createQualityProfiles.js - create Virto way TypeScript profile and Virto way CSS profile, set them as default (to run, type in terminal node createQualityProfiles.js)
- createGroups.js - create custom TeamLead group and permission (to run, type in terminal node createGroups.js)
2 service files created
- index.js - gets quality gates conditions from reference SonarQube server
- requests.http -used for SonarQube API tests with VS Code Rest client