Build Time Increase by 40 min since 03/08/21 - Primarily Test Project Build is eating all the time

Hello,

We’re experiencing higher build time for Test project if SonarcloudAnalysis is on since 03/08, before that it was usually taking about 2-3min but since this date it jump to 40+ min.

We tried to revert back our code changes to see if it’s related to our code changes with no luck, even if we are running an old PR which took less time prior to this date but now its build time is on higher side

We did some changes in SonarCloud Profile for the project but only thing we did, just created a new profile inherited it with Default SonarCloud Profile

Would like to know if you guys released anything same time which can affect this, if not could any of you please help out, would highly appreciate

Thanks

Hi @Schumi

Can you make sure that you are using SonarScanner for .NET 5.1 ? Version may be found on the header of the logs for that task.

If yes, we stopped categorising TestProject by their name (*Test). Is that you case ? If yes, this might be a reason why your project is now categorised as Product Code, so then iit’s analyzed by SonarCloud.

If you don’t want it to be analyzed, you can add either the true property in your csproj, or true

HTH,
Mickaël

Hi @mickaelcaro

Thanks for the quick response, few thing I would like to confirm

Can you make sure that you are using SonarScanner for .NET 5.1 ? Version may be found on the header of the logs for that task. - I couldn’t find it in Header, hope you’re referencing this Header(Attached screen)

If you don’t want it to be analyzed, you can add either the true property in your csproj, or true - I didn’t get which property inside .csproj I’ve to marked as true also I’m hoping after making this change our code coverage, quality gate and analysis will work as before

Thanks

Hi @Schumi

You’ll find the version in either Prepare analysis configuration or Run Code analysis task for SonarCloud, in fact it’s a bit below the header at the beginning of the logs (few first lines).

For the property, you’ll have to create it since it doesn’t exist (it’s set on the fly by us or the value is read if it’s found inside one csproj).

@mickaelcaro

Yes, we are using desired version

For the property, you’ll have to create it since it doesn’t exist (it’s set on the fly by us or the value is read if it’s found inside one csproj). For this Could you please send it to me with complete syntax and place to put in so that I can make changes and try

Thank you so much for quick responses

Sure, just add this inside your Test project csproj, see what it does :

<PropertyGroup>
  <!-- Project is a test project -->
  <SonarQubeTestProject>true</SonarQubeTestProject>
</PropertyGroup>

Edit: fixed comment

@mickaelcaro
Made this change in Main Website Test project which is referencing all other test projects(hope I don’t have to update .csproj for all test projects) but still result is same

Another thing I want to mention is I’m also feeling

project is now categorised as Product Code, so then iit’s analyzed by SonarCloud.

as our project warning got doubled from 4k+ to 8k+

Just for the safer side I ran the pipeline twice, What could be the next step

Thanks

Hey @mickaelcaro Could you please advise here

Hi @Schumi

Are you seeing some warning on your test projects as well in the logs ?

In SonarCloud dashboard, do you see your test projects analyzed with their lines of code displayed ?

@mickaelcaro
Are you seeing some warning on your test projects as well in the logs ? - Yes, almost 4284, more than the website project warning

In SonarCloud dashboard, do you see your test projects analyzed with their lines of code displayed ? - Not Sure how can I verified this, could you please share the steps and it should be verified against master repository or the branch where we have recent csproj changes

Thanks in advance

Just go to the “Code” tab of your project on SonarCloud, you may see all the sources and eventually the test projects. But seeing the warning i think they are detected as product code.

Could you please send me the logs of the build task ? i would need them in diagnostic verbosity, so that i can see where our detection is failing.

I’ll PM you so you can share them privately.

Thanks in advance.

But seeing the warning I think they are detected as product code. - Yes Definitely the case

Please PM me so that I can share them

Thanks and really appreciate you for looking into this

Hi All,

With the help of @mickaelcaro, we are able to solve this problem.

in the WebSite.Test build task, add the following parameter :
/p:SonarQubeTargetsImported=true

1 Like

Issue came from the non- deinstallation of the targets, leading to builds after the analyzed one were still analyzed.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.