# SonarCloud Pull Request integration with multiple builds

**URL:** <https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992>\
**Category:** SonarQube Cloud\
**Tags:** azuredevops-services, pull-request\
**Created:** [August 23, 2018, 7:50am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992 "2018-08-23T07:50:08Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [August 23, 2018, 7:50am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/1 "2018-08-23T07:50:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xbourguignon](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/xbourguignon/32/55_2.png) [@xbourguignon](https://community.sonarsource.com/u/xbourguignon)\
**Post date:** [August 24, 2018, 9:53am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/2 "2018-08-24T09:53:58Z")

</div>

Hi Greg,

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

---

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [August 24, 2018, 11:47pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/3 "2018-08-24T23:47:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xbourguignon](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/xbourguignon/32/55_2.png) [@xbourguignon](https://community.sonarsource.com/u/xbourguignon)\
**Post date:** [August 27, 2018, 9:24am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/4 "2018-08-27T09:24:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [August 27, 2018, 9:47am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/5 "2018-08-27T09:47:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![xbourguignon](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/xbourguignon/32/55_2.png) [@xbourguignon](https://community.sonarsource.com/u/xbourguignon)\
**Post date:** [August 27, 2018, 12:31pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/6 "2018-08-27T12:31:20Z")

</div>

Understood.

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

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/1X/6591a717de5ea64a64873cad5ba3788c19603d36.png)

Whereas there’s a specific SonarCloud report per build

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/1X/51717e9cc5d8912ac24ad50e3356ba33b4047cab.png)

---

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [August 27, 2018, 9:54pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/7 "2018-08-27T21:54:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![xbourguignon](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/xbourguignon/32/55_2.png) [@xbourguignon](https://community.sonarsource.com/u/xbourguignon)\
**Post date:** [August 28, 2018, 10:10am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/8 "2018-08-28T10:10:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [August 28, 2018, 9:30pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/9 "2018-08-28T21:30:53Z")

</div>

Thanks so much! Much appreciated

---

<div class="post-metadata">

**Author:** ![Smenus](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/smenus/32/1083_2.png) [@Smenus](https://community.sonarsource.com/u/Smenus)\
**Post date:** [October 8, 2018, 9:13am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/10 "2018-10-08T09:13:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [December 7, 2018, 10:21am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/11 "2018-12-07T10:21:19Z")

</div>

Any news on this?

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [December 7, 2018, 1:29pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/12 "2018-12-07T13:29:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rafalkasa](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/rafalkasa/32/2044_2.png) [@rafalkasa](https://community.sonarsource.com/u/rafalkasa)\
**Post date:** [January 2, 2019, 8:12pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/13 "2019-01-02T20:12:36Z")

</div>

Hi

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:  
[https://github.com/SonarSource/sonar-github/pull/31](https://github.com/SonarSource/sonar-github/pull/31)

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

---

<div class="post-metadata">

**Author:** ![Ian\_Bennett](https://avatars.discourse-cdn.com/v4/letter/i/5e9695/32.png) [@Ian\_Bennett](https://community.sonarsource.com/u/Ian_Bennett)\
**Post date:** [January 29, 2019, 1:20pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/16 "2019-01-29T13:20:43Z")

</div>

+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 ☹  
Has anyone got any workarounds?

---

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [January 29, 2019, 11:42pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/17 "2019-01-29T23:42:46Z")

</div>

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.

thanks,

Greg

---

<div class="post-metadata">

**Author:** ![danalaw](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/danalaw/32/2639_2.png) [@danalaw](https://community.sonarsource.com/u/danalaw)\
**Post date:** [February 22, 2019, 12:51pm UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/18 "2019-02-22T12:51:06Z")

</div>

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.

Thanks,  
Dana

---

<div class="post-metadata">

**Author:** ![Fabrice\_Bellingard](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/fabrice_bellingard/32/39_2.png) [@Fabrice\_Bellingard](https://community.sonarsource.com/u/Fabrice_Bellingard)\
**Post date:** [February 24, 2019, 9:13am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/19 "2019-02-24T09:13:32Z")

</div>

Hi all, just to give you heads up on this: we were not able to progress on that topic just yet. This is not forgotten - just not on the top of the list of the current priorities. 😕

---

<div class="post-metadata">

**Author:** ![gregpakes](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/gregpakes/32/756_2.png) [@gregpakes](https://community.sonarsource.com/u/gregpakes)\
**Post date:** [March 12, 2019, 12:13am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/21 "2019-03-12T00:13:08Z")

</div>

This issue really hampers the usefulness of SonarQube.

The main purpose for me is to stop a codebase getting worse. This is acheived by blocking PRs based on a quality gate. This bug renders the blocking a PR based on quality gate useless.

The blocked status of the PR is dependent on a random triggered build.

There could be 4 builds, one of which is fine and the other 3 introduce major issues and have a failed quality gate. Yet the PR can be merged with no issues.

This is a big issue and needs a higher priority.

---

<div class="post-metadata">

**Author:** ![StephenLarkin](https://avatars.discourse-cdn.com/v4/letter/s/47e85d/32.png) [@StephenLarkin](https://community.sonarsource.com/u/StephenLarkin)\
**Post date:** [March 12, 2019, 10:34am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/22 "2019-03-12T10:34:46Z")

</div>

I would like to also voice our support of this feature. Having only a single Quality Gate and PR decoration is unworkable for us. We have had to split our builds out to only build the code that has been changed in a Pull Request, otherwise all of our build agents get utilized, and we end up with a huge queue that doesn’t clear until after everyone’s gone home.

VSTS supports and encourages this practice. It only makes sense that SonarCloud works with this model as well.

This, for us, is a huge deal, which we believe needs to be addressed as a higher priority.

---

<div class="post-metadata">

**Author:** ![Joao\_Goncalves](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@Joao\_Goncalves](https://community.sonarsource.com/u/Joao_Goncalves)\
**Post date:** [March 14, 2019, 11:05am UTC](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992/23 "2019-03-14T11:05:09Z")

</div>

+1.  
Same situation for us, at the moment this is a complete deal breaker.  
We also use the split build approach but its starting to get a point where it’s cumbersome to maintain since the projects and builds keep increasing.

I understand that there might be more concerning issues on the backlog but it would be great if we could have a fix for this as soon as possible.

[Next page](https://community.sonarsource.com/t/sonarcloud-pull-request-integration-with-multiple-builds/1992.md?page=2)
