Having sub-projects within a sonarqube project - sonarqube

I have CI setup with a few C# applications for service fabric.
I'm running the SonarQube scanner on a few projects with my CI tool, but I would like the data to be aggregated into one project in SonarQube, and have it separated by sub-folder/"component". However when I try to push results to one project, it just wipes out all the previous history of the past project.
For example I want my single sonarqube project to look like:
SonarQubeProject
-- serviceProject1
-- serviceProject2
where project1 & project 2 are analyzed separately. Is there a way to do this?

SonarQube 6.7 will introduce the concept of "Application"s as a paid feature (part of the "governance" plugin). This feature will allow the user to group several SonarQube projects into a bigger application.

Related

run release tasks selectively based on project code changes

We are using VSTS for build and release management, and using CI/CD. Typically, our solutions consist of a web application project, and a database project.
Our current release tasks take the application offline (using app_offline.htm), publish the database, then publish the web application. Publishing the database project often results in no changes, as due to CI/CD we are much more frequently updating code on the web app than changing the db schema.
Is there a way to only run the database publish task (using WinRM) when it detects a change in the database project code, in our git repository?
EDIT: This in itself isn't a problem, as typically when the DACPAC gets published, there will be no activity. HOWEVER, I've been requesting that the database is backed up using the /p:BackupDatabaseBeforeChanges=true flag - which seems to back up the database even if there are no changes. This is an issue for large databases.
The simple way is that you can separate web project and database project to two build definitions.
Create a new build definition
Enable Continuous Integration in Triggers tab
Specify Path filter to include database project
Modify Visual Studio Build task, specify /t:[database project name] argument in MSBuild Arguments box to just build database project
The same steps for web project
Create a new related definition
Add artifacts for previous two build definitions and enable Continuous deployment trigger
Add two environments (e.g. database, web)
Open Pre-deployment conditions of an environment (e.g. database)
Enable Artifact filters and select corresponding artifact (e.g. database build artifact), specify build branch (can specify *, it means all branches)
Add tasks to just deploy database in this environment
The same steps for web environment
The answer is - exactly what I want isn't possible.

Selected project build from multi project repository using Bamboo

Hi I have a SVN repo with around a 100 projects/apps (maven projects). All of them are totally independent and are build and and deployed in the same way. Using Bamboo can I (using one build plan) build only the the latest updated projects(from the last commit in the repo) or must have a separate build plan for each app.
Both ways are correct. It depends more on infrastructure setup. Do you deploy all 100 apps on same server and same directory? How similar are all 100 applications? What are future plans? Are you planning to move to Git in future? Are those 100 projects planning to be totally different in few months? If you don't foresee any change in next 4-5 months then you can have one build plan and pass app/project name as parameter.

Eclipse sonar plugin vs findbugs+pmd+checkstyle eclipe plugins

We are trying to install a CI Platform with (Jenkins,sonar,eclipse ...).
So that every developer can make analysis on his code before commit, I'm wondering between two alternatives :
running local analysis with the sonar plugin.
install the different plugins that sonar use (findbug,pmd,checkstyle ...) and configure them to meet the sonar configuration.
I'm not sure which alternative to use? I used to work with findbugs,pmd, checkstyle in eclipse and they look great.
Can you tell me which is the best alternative?
Thanks in advance.
Regards.
With Sonar plugin you can manage the violations like:
Create a review
Mark a violations as false positive or fixed
View the hot classes and hot violations
View yours reviews
If you use separate plugins you have to go sonar web to do that.
The great advance of sonar is the reviews.
Other question is how many projects you have and will have. I currently work with more than 70 projects and many profiles. Is more simple to me run analysis with one plugin, because I need just add the server and find the project. With other plugin you need add the link for each project in each plugin configuration.
Why not install the Sonar Eclipse plugin?
This was designed to solve the following problems:
Sonar does not support parallel analysis of the same project. This issue rules out the option of each developer running Sonar locally. (See SONAR-2761, SONAR-3306)
You don't really want developers uploading metrics and source code into the Sonar database. They could be working on an uncommitted workspace and would therefore cause both inaccuracies and confusion if Sonar is being used for code review.
Sonar is really designed to be run from a continuous integration server (like Jenkins), building code that has been submitted onto a shared codestream (or branch)
The big advantages of using the Eclipse plugin are:
True local analysis, no updates of the Sonar database
Configuration of the other tools is retrieved from the Sonar server and jars automatically downloaded.
Centralized management of Sonar quality profiles

Jenkins- multiple locations SVN. Is it possible to specify the build version

I am new to Jenkins CI tool and I want to know if it is possible to specify what build to use when there are several projects, on different SVN locations, dependent on one another. For example, if I have the web project on SVN location1 and the backend project on SVN location2 and the web depends on the backend and one of the developers modifies something in backend, when the web developer does a commit, there will be a build failure. Is there the possibility to specify that the build from the web part should take into consideration build x from backend and not the newest build?
Thanks in advance.
yes that can be done. in Jenkins check for the Build Triggers options in your project web-settings and on the line Build after other projects are built you can specify the name of projects you want to build automatically after there has been changes made to the base project.
And similarly, in the Post-build Actions, look for Build other projects, where you can specify that if the base project builds successfully, it will automatically trigger a build on children projects.
Hope this helps.
Your example of building a project against a specific version of another project is a little non-standard, but not impossible.
In your case, I would use Jenkins' ability to execute arbitrary scripts to help. The script would take care of getting the correct version of the project that the one I want to build depends on.
Building on your example of a Web and Backend project, here's how I would do things without using a parametrized build:
Add a file to the repository of the Web project that stores the version of the Backend project to use
Configure a job to build the Web project when the source for the backend project changes in SVN.
The project should check out the latest version of the Web project
The first Build Step for the project would be a script (Execute Shell or Execute Windows Batch Command) that does the following:
Gets the version of the Backend to use from the file containing the version info
Either pulls the appropriate version of the Backend from the Backend's repository; or pulls the source of the appropriate version of the Backend's source
(If you pulled the source only for the Backend, the next Build Step should be to build the Backend next)
Build the Web piece
Do any unit tests

SONAR - Ant Script for sub Project

I have some projects and i wrote an ant script to run sonar with this projects.
Its okay so far. But i need to show these projects under a top level project like sub projects.
I am using just Ant to run sonar and i just working on pure code not on binaries.
(I just need to analysis)
I could not find how i can solve this.
You have 2 choices:
Either those projects are really linked together, and you can configure an Ant build script to have a multi-module project that wraps all your projects => http://docs.codehaus.org/display/SONAR/Analyse+with+Ant+Task#AnalysewithAntTask-Analysemultimodulesproject
Or those projects are different (=> they have different lifecycles, they are functionnaly different, ...), and the best option is to use the Views Plugin => http://www.sonarsource.com/plugins/plugin-views/Overview/
Sounds like you need the Views-Plugin: http://www.sonarsource.com/plugins/plugin-views/Overview/
The SonarSource Views Product enables the creation of any aggregation
trees to regroup projects. Projects can for instance be grouped by
applications, applications by team, teams by department… Each level of
the tree is a View and offers all standard services such as dashboard,
hotspots, timemachine, drilldown… showing the consolidated measures.

Resources