Can I set two different quality gates in one sonarqube project?

Hello, I am using SonarQube Enterprise 9.9.3. Is there a way to set two different quality gates in one sonarqube project (ex: one for prod and another for dev). Trying to separate dev projects from prod which are located in the same repository.

I saw it wasn’t a feature for the developer version in an old post but wasn’t sure if that were still the case and for enterprise

Hi,

we use Sonarqube Enterprise latest.
While it’s possible to have a different reference branch new code setting for every branch of a project,
the quality profile and quality gate setting is a setting at project level.
Means there is only one quality gate and profile.

IMO it doesn’t make much sense to have different settings for dev and prod.
The dev version will lead to the next prod version and should use the same settings from the start.
If you really want different quality gates you must use two different projects.

Gilbert

Thank you so much Gilbert :smiley:

Do you happen to know if it’s possible to create 2 sonarqube projects from 1 repository? If the prod and dev codes are in the same repository can you scan it like a monorepository?

Sure, you just need to use two different projectkeys, property sonar.projectKey
If you do a search for monorepo the Sonarqube docs bring up only

see “Reporting your quality gate status on pull requests in a mono repository”

Just use different sonar.projctKey, i.e. com.foo:bar-prod and com.foo:bar-dev