Tag projects through sonar-scanner

It’s possible to add tags to projects through the web interface, but in a CI environment, you would want to set the tags for a project through the sonar-scanner.

The parameter on the scanner should accept a comma separated string where each item would represent a tag;
If a tag exist on the project, but not in the list supplied by the scanner, it should be removed from the project. This rule should toggled on/off through the global settings in SonarQube;

Ideally, it would be done using /d:sonar.project.tags="tag1, tag2, tagN" or /d:sonar.tags="tag1, tag2, tagN"

Hi,

+1
this would be useful for CI/CD builds.
The documentation https://docs.sonarqube.org/latest/project-administration/project-settings/ has only:

Project tags allow you to categorize and group projects for easier selection on the Projects page. Project tags can be administered from the project home page.

In the meantime you may use the web api api/project_tags/set (available since SQ 6.4) straightly.

Gilbert

1 Like

Yes, until the sonar scanners itself has been updated, we will be using the api’s to post this straight after the scanning has completed

thanks for the suggestion !