Failed to execute Task error with msbuild step - msbuild

I just installed the latest version of sonarqube on my server and did a test run on my project with the sonar-scanner executable. This works.
In the next step, i'm creating a new VSTS Build Definition with the existing SonarQube build steps.
When I trigger this build, it fails in the last step, after the report has been uploaded to my SonarQube server:
VSTS build log
SonarQube server log
I don't know why this happens, because the sonar-scanner is working just fine. I'm using the same parameters in my MS Build step.

Looks like your VSTS task is pending completion of the Background Task on SonarQube server side, as per this log in your first screenshot:
Waiting on the sonarqube server to finish processing in order to determine the quality gate status
(note: this is a log from the VSTS task itself, not from the SonarQube Scanner which did finish successfully)
The problem is that the Background Task actually fails with an error as per your second screenshot. The failure corresponds to bug SONAR-8013 (fix to be released in upcoming SonarQube 6.1).

Related

SonarScanner CLI error: failed to request and parse localhost:9000

When using SonarScanner against a local source, following the suggested manual recipe for classic .NET and MSBuild, I find the following error (look at the bottom line):
SonarScanner for MSBuild 5.5.3
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
11:30:19.134 Updating build integration targets...
11:30:23.344 Failed to request and parse 'http://localhost:9000/api/server/version': An error occurred while sending the request.
What's wrong? How to resolve this?
It has worked for me: I am a beginner, so I didn't know - and the suggested manual recipe doesn't mention it - that local mode requires a running SonarQube instance, working on this particular endpoint.
So before you run SonarScanner locally, you need to have a local SonarQube server, at least with the default configuration of SonnarScanner.
How to install SonarQube locally? Here is the instruction: Install the Server | SonarQube Docs.

No **\*Test.DLL sources found matching the given filter: Release Pipeline

I am a newbie with Azure CI/CD. I was trying to setup a release pipeline to run the Specflow tests. However I am getting the below error after running the Vstest agent
VSTest Agent Log Screenshot
I can successfully the build the project and below are the release pipeline setup:
Although I don't see in the "Download Artifacts" stage that test libraries were downloaded to the test directory
Download Artifact Log Screenshot
All my tests are running fine on Visual studio local. It's a .Net5 project.

VSTS SonarQube cannot find TRX file

I am using Visual Studio Team Services to carry out an automated build, and using SonarQube to display Code Quality, Coverage, etc. I am also using a privately hosted build agent.
The build steps all work successfully with data being processed and populated through to SonarQube which is great. However, no code coverage is being displayed in SonarQube. After looking through the logs in VSTS I found that SonarQube is looking for the .trx file (which contains code coverage) in a different directory to the one that VSTS publishes the .trx file to.
So when VSTS builds the solution it creates the test results file here: C:\agent_work\3\s\TestResults
But SonarQube is trying to use test results from here: C:\agent_work\3\TestResults
On the build server, if I manually copy the .trx file into the correct location and then run the build again, the code coverage all works fine and processes through to SonarQube. So the issue is definitely the mismatch of the locations where the .trx is published and where it is to be picked up form.
I can't find a way of changing the publish location, or the SonarQube source location.
Please help!
This is a known issue, and will be fixed by the next release. See: https://jira.sonarsource.com/browse/SONARMSBRU-262.
We just announced the RC versions of the products that have this fix, you can give them a try. See this thread.

SonarQube not showing analysis results from Team Build

I am using SonarQube 5.2 integrated with Team Build being executed using an on prem agent connected to Visual Studio Online. The build completes and shows a summary of SonarQube results in build summary, screen shot below. However, when I navigate to it the results are not available in SonarQube dashboard.
I am trying to understand why the analysis results are not uploading into SonarQube dashboard?
Indeed, as pointed out by Bogdan Gavril, since SonarQube 5.2, the analysis results are not immediately available on the server: There is a background task running on the server that does some further analysis - the project only becomes visible when that background task is completed.
You can see the status of the backgrounds tasks by navigating to: Administrator -> Projects -> Background Tasks

How to configure TeamCity to run last successful build on failure?

We're currently using TeamCity Enterprise 9.0 for our continuous deployment process; so please imagine the following scenario, you deploy your latest code to the dev branch, but one of the nugget packages was removed from the source and the build fails, QA team comes in at night and finds the build is broken and the environment is down for testing.
So I was wondering if there is a way to configure TeamCity to automatically run the last successful build in case the current code version fails, like configure it to make it aware that the current branch is broken and thus go back to a previous stable state.
Thanks,
The recommended approach is to have a separate build configuration for Deployment task. In this case you will be able to configure artifact dependency with option get artifacts from "Latest successful build".
Also see how to set up deployment with TeamCity.