Can we add custom field for a project in SonarQube Database Tables like dbo.projects?

I am working with SonarQube Community v7.9.4 LTS integrated with MSSQL Database

Can we add custom field for a project in SonarQube Database Tables like dbo.projects ?

Hello @Tripti_Mittal,

So you cannot add any extra fields in database. If you explain the use case I can possibly suggest solutions.

Olivier

We are looking forward to capture 4 parameters/details related to each project that gets created in SonarQube

Can you elaborate a bit more please: What parameters/details ? Where do these parameters come from?
Please take the time to write a few sentences so that we have a chance to help you.

Olivier

for example: with every project we create we want to capture :-

  1. Division
  2. Application Name
  3. Primary Approver for Project Creation
  4. Secondary Approver for Project Creation

Do we have any provision in dbo.projects table to get these values captured or add new fields to capture these values ?

Thanks, now that becomes clearer. That’s the kind of information that is useful and you may want to add in your first post in the future. And don’t focus on the solution (eg in your case you went straight to a DB solution) but on the need. We’ll tell you the best way if there is a way.

First, I repeat, you should never directly modify the database. You’re exposed yourself to plenty of unpredictable side effects and we’ll not help you if you do so. Everything must be provisioned from the UI or from the APIs

Second, before we come to a technical solution, I want to highlight that, even if SonarQube is fairly extensible, it is meant to be a code quality and security management tool. Be careful to not drift too much to an all purpose software project management tool.

To achieve what you want in SonarQube the best is probably to use projects tags.
Tags are metadata attached to a projects that can hold virtually anything.

  • The Division (as I can imagine what it is) is a good candidate for tags
  • I am not quite sure of the Application Name ? Is this a superset of the concept of SonarQube project ? If Application = Project, then simply give the app name to your project name, If Application = Group of projects, then use tags

I really don’t understand the use case for approvers. Why do you need this information in SonarQube ? Does it drive any process in SonarQube ?

Olivier

2 Likes

Thanks Olivier ! Application Name is related to our projects since we have more than 1 applications in a project…

Project Tags is one option I was already looking into…but we need to give comma(,) separated tags for the same correct ?

That’s correct as per the api/project_tags/set documentation. The comma separated list will be broken down in several tags that will all be set for the project. (So when adding a tag you should read the existing ones and append your new tag, and when removing, you should read all the existing tags and remove your no-longer-needed tag from the list and apply the updated list)

1 Like

Thanks @OlivierK !
Is there any provision on the SonarQube Server to restrict access to Tags ?

If I don’t want anyone or everyone to make changes to the Project Tags…

That’s understandable :innocent: . You can have the details of the required permissions needed to edit tags by looking at the API documentation (and that’s true for any operation, not only tags). In a nutshell you need the have Administer permission on the project to edit the project tags.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.