Auto apply different permission profiles on project creation

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this

Hi SonarQube,

SonarQube version : 8.9.6

The entire story is like this: we have five developer teams, and they have five distinct groups in SonarQube.

I have read this thread (How to auto-apply a Permission template (with Project Key Pattern) - #7 by Denis) and created a permission profile with a project key for TEAM one. In that permission profile, I assigned that group one must have full permission.

We built a project with bambo. It was created on SonarQube with no access for Group One! because I realized as long as the second permission profile is not set as default, it wont be triggered.

I set the second permission profile as the default for projects, and once we built the project with bamboo, it was created on SonarQube with the right permission for Group One. However, the issue is, if team two builds a project with bamboo, the project still receives permission from group one!!

In this case, what is the solution to having different permission profiles (5) with different key patterns and having them all be checked when a project is being built?

Hey there.

Most likely, your key pattern isn’t matching your project keys.

What key patterns are you trying to use, and what are the project keys you expect to match them?

Hi Colin,

Thanks for your response.

As depicted in the figure, I set com.sonar* and what we set for the project key was com.sonarqube.vpt.forum

Thanks.

Regex101 tells me that those don’t match.

True , but in the link that i shared, someone from SonarQube mentioned it explicitly :

" Note that my first test didn’t work. I used a bash pattern (com.sonar* ) rather than a valid regular expression (com.sonar.* )."

However, if the expression was wrong, why then it worked when i made the second permission profile default?

I will try with " com.sonar.* " and see what happens without setting the permission profile default for all projects.

thanks, the problem was with the regex.

it works and one can create as many as permission profiles with different project keys patterns.

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