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"
+1
this would be useful for CI/CD builds.
The documentation 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.
The purpose of tag is to set on project level.
When you use sonar-scanner to set the tags it would become difficult when the number for branches and PR are huge, making it un reliable solution.