Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically remove Sonarqube branch projects when git branch merged / removed

We currently have a jenkins pipeline using Multibranch Workflow plugin. Each git branch execute a sonarqube analysis creating a sonarqube project using the sonar.branch property. This is very useful because each branch is being analyzed before merge it, the problem appear when a branch is merged with master and disappear on GIT, the project continues on sonarqube and need to be deleted manually. Is There a way to do it automatically? or any other recomendation?

like image 617
Fernando Rosado Avatar asked Jul 06 '16 09:07

Fernando Rosado


People also ask

How do I delete a branch in SonarQube?

You can delete a branch in the Branches tab at Project Settings > Branches and Pull Requests.

How do I change the default branch in SonarQube?

Default Branch name in Community Edition If you want to change that in SonarQube then there is no user interface option available, as is in higher editions under Administration –> Branches and Pull Requests.

What is master branch in SonarQube?

Master / Main Branch This is the default branch and typically corresponds to what's being developed for your next release. This branch is usually known within a development team as "master" or "head" and is analyzed when no specific branch parameters are provided.

How do I add a branch to Sonarcloud?

On your project, go to Administration / Branches & Pull Requests. There, you will see in the top-right corner a text like this: "Long living branches pattern: (branch|release)-. * ". That means that when the name of the branch starts with branch- or release- , then it will be considered a long-living branch.


1 Answers

The best way to remove SonarQube branch projects is to not push them to the server in the first place. Here are your options:

  • use SonarLint to spot issues directly in your IDE
  • if you're using GitHub, use the GitHub Plugin
  • if you're using BitBucket, use this plugin or this one

At SonarSource, we use SonarLint and the GitHub Plugin on a daily basis. One last solution is to delete manually the project using the api/projects/delete web service.

like image 175
Teryk - SonarSource Avatar answered Sep 28 '22 08:09

Teryk - SonarSource