Sonarqube Pull Request integration with multiple builds

pull-request
vsts

(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

Understood.

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

Whereas there’s a specific SonarCloud report per build


(Greg Pakes) #7

Hi,

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.

thanks,

Greg


(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.