Our company is using sonaqube version 7.8 Community Edition. GitHub for version control and Bamboo for builds, version 6.9.2.
What I am trying to achieve is, Apply my custom quality gate to projects managed by my team.
To fail build if new code coverage in below 80%.
What I was able to do so far?
I was able to create my own quality gate, lets call it ‘ABC way’.
ABC way is applied to develop branch of the project in SonarQube.
ABC way is not the default Quality gate, if I make it default it applies to every single project in company which I don’t want.
I was able to configure Bamboo to fail the build if the quality gate is not passed.
The problem I am facing is since every new branch is a new project in SonarQube, when I branch off from develop branch, this new branch has default quality gate not the custom one I applied to develop branch of same project and hence it doesn’t fail the build when necessary.
All I want is, my ABC way to apply to any branch I create from my develop branch, for the project my team manages.
One way to do this is to make ABC way default quality gate, but then it applies to every single project in SonarQube, which I don’t want.
Can someone please point me out to what I am missing here or any other way to configure it?
Welcome to the community!
You have the ability to explicitly assign a project to a non-default Quality Gate. I think this is what you need.
Hi @ganncamp thanks for the response. But that is exactly where I am facing the issue, so when I create a new branch the quality gate is overridden by default.
I am new to Sonar so might be missing something here. Also to add to it, I dont have a project created for my team specifically. I’ll attach a screenshot of it.
Do you mean crearte a project here?
I’ll be more specific here, lets say I have my quality gate `ABC way’ - non default
and default quality gate is DEFAULT way.
My project is ‘new-project’ and we integrate to develop branch. So project name is Sonar is new-project develop.
I can apply my non-default quality gate (ABC way) to ‘new-project develop’
Now, when I create a new branch say ‘feature/add-status’
Here is the issue now this branch will be created as new project in Sonar.
Now `new-project develop’ still has ABC way as quality gate
But ‘new-project feature/add-status’ has DEFAULT way as quality gate.
But I want ABC way to apply to ‘new-project feature/add-status’
Each branch should inherit its parent project’s Quality Gate.
Each project can be assigned to a non-default Quality Gate.
Yes, this is indeed the issue. It seems that your analysis parameters aren’t being set correctly to associate the new branch to the existing parent project.
The only time to “create” something via the SonarQube interface is perhaps at project initialization (this can also be done automatically on first project analysis). After that, you have no need for anything labeled/named “create” in the UI.
Does this make sense?
Thanks for the response.
I also believe that something is set wrong in analysis parameters, but I dont know what.
Is there a specific parameter I need to set, to let a project know(when a new branch is created) that this is your parent project? And if yes, is there a way to do it through UI in community edition version 7.8?
Also, I didn’t get the second part of your response, from where you say The only time to “create”… Can you please help me understand it?
Also, we use maven for our builds, I know there are some sonar parameters we set in properties of pom.xml.
Do I need to configure anything there?
Community edition doesn’t support branches. That’s likely the root of your problem. Since branches aren’t available in CE, then each project branch you analyze must become a new project in SonarQube. So then the possibility of inheriting the parent project’s Quality Gate is out.
So… at this point, your best option is to create each branch in SonarQube ahead of time and configure it’s Quality Gate to your non-default one.