Sonarqube Pull Request integration with multiple builds


(Greg Pakes) #1

We have a scenario where a single VSTS Pull Request can trigger multiple builds. The issue is that SonarCloud only creates a single code quality status against the PR which seems to only link to one of the builds.

Is it supported to have multiple builds and use the pull request integration? If so, should there not be 2 status gates?

When you click the link, it takes you to one of the builds in SonarCloud and not the other.

(Xavier Bourguignon) #2

Hi Greg,

How do you configure VSTS to trigger multiple builds with a single PR ?

(Greg Pakes) #3

Its a fairly standard configuration. If you have multiple solutions in a single git repo, you setup CI builds with path filters.

Then in your PR config you setup build validation using the same path filters.

(Xavier Bourguignon) #4

ok, if you trigger multiple analysis in the same build definition, you will have only one link to SonarCloud quality status.

A good practice is to have one build definition with only one analysis per solution in your single git repo.

(Greg Pakes) #5

Apologies, I don’t think I was clear. I don’t have multiple analysis in a single build definition. I always have a single analysis per definition. But a pull request can trigger multiple builds. This is a standard feature. This is why VSTS supports Path Filters.

(Xavier Bourguignon) #6


And in the Pull Request page, there is only one Status

Whereas there’s a specific SonarCloud report per build

(Greg Pakes) #7


Yes that’s exactly right. The main issue is that there is only one Status Gate on the PR whereas there should be 2. In our scenario, we have this Status Gate as a requirement for PR completion. So as there is one one gate, the second build gets ignored completely, allowing the PR to be completed without the SonarCloud issues fixed.



(Xavier Bourguignon) #8

I confirm that the link on the PR will be the quality status of the last triggered analysis.

I see with the dev team if we can improve this.

(Greg Pakes) #9

Thanks so much! Much appreciated

(Sean Fleming) #10

Hi Xavier,
Sorry to resurrect this thread after a month, but I was wondering what the outcome of asking the dev team was - we have the same issue with our PR status gate.
Thanks, Sean.

(Greg Pakes) #11

Any news on this?

(Fabrice Bellingard) #12

Hi Greg,

our dev team acknowledged that the PR decoration was not working well in such situation, and there is now a ticket in the backlog. I just can’t give you an ETA for it.

(Rafal Kasa) #13


Do you know any news in reference to multiple SonarQube analysis per project on one pull-request ?
I already purchased the SonarQube license to have the possibility of Pull Request analysis and for PR when changes are from two different projects eg. angular and .NET I only see comments and status from one of them.

A similar issue was fixed for Jenkins please look at this PR:

Thank you in advance to add such feature into SonarQube Extension for VSTS

(Ian Bennett) #16

+1 We have this exact issue on VSTS/DevOps. Or build builds both Angular & .NEt Projects and runs an analysis against each one. The one which finishes last always overwrites the status and comments fromn the other analysis.
We literally just got our license yesterday and this is a showstopper for us :frowning:
Has anyone got any workarounds?

(Greg Pakes) #17

Hi @Ian_Bennett

I’m pretty sure there aren’t any workarounds at present besides a full re-structure of your repository.

We are at the dev teams mercy.



(Dana) #18

Hi All,

Any news on fixing this issue or if it’s in process of being fixed by the devs? Our team is experiencing this issue as well.