TFS, Could not find a file on the SonarQube server SonarQube.MSBuild.Runner.Implementation.zip - tfs

SonarQube version 9.6 (Community Edition) Deployed on Azure
TFS 2018 Update 16.131 TFS
Sonarqube extension version 4.23.1.266 (Had to use an older version
because TFS only allowed <25mb extensions)
Code .NET Framework 4.7.2
I deployed sonarqube using this github repo. https://github.com/vanderby/SonarQube-AzureAppService. When executing the build in TFS, I get the following error.
2022-09-08T07:02:17.1827740Z ##[section]Starting: [DEPRECATED] Fetch the Quality Profile from SonarQube
2022-09-08T07:02:17.1936543Z ==============================================================================
2022-09-08T07:02:17.1940305Z Task : SonarQube for MSBuild - Begin Analysis
2022-09-08T07:02:17.1941880Z Description : [DEPRECATED] Fetch the Quality Profile from SonarQube to configure the analysis
2022-09-08T07:02:17.1943771Z Version : 1.0.50
2022-09-08T07:02:17.1945481Z Author : Microsoft Corporation
2022-09-08T07:02:17.1946562Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=620063)
2022-09-08T07:02:17.1947917Z ==============================================================================
2022-09-08T07:02:17.2127920Z ##[warning]Task 'SonarQubePreBuild' (1.0.50) is using deprecated task execution handler. The task should use the supported task-lib: https://aka.ms/tasklib
2022-09-08T07:02:17.2137624Z Preparing task execution handler.
2022-09-08T07:02:18.4131002Z Executing the powershell script: D:\Agent\TFS_AGENT_06\_work\_tasks\SonarQubePreBuild_eae5b2cc-ac5e-4cba-b022-a06621f9c01f\1.0.50\SonarQubePreBuild.ps1
2022-09-08T07:02:18.9665316Z ##[warning] The ownership of the SonarQube related build tasks is being transferred to SonarSource.
2022-09-08T07:02:18.9674084Z ##[warning] Please replace this build task with the one brought by SonarSource's extension on the marketplace: https://aka.ms/sqextension
2022-09-08T07:02:18.9681553Z ##[warning] For more details go to https://aka.ms/sqtransfer
Removed blank lines
2022-09-08T07:02:19.6273139Z SonarQube Scanner for MSBuild 1.1
2022-09-08T07:02:19.7283557Z Default properties file was not found at D:\Agent\TFS_AGENT_06\_work\_tasks\SonarQubePreBuild_eae5b2cc-ac5e-4cba-b022-a06621f9c01f\1.0.50\SonarQube.Bootstrapper\SonarQube.Analysis.xml
2022-09-08T07:02:19.7285250Z Pre-processing started.
2022-09-08T07:02:19.7285878Z Preparing working directories...
2022-09-08T07:02:19.7287268Z Checking for updates...
2022-09-08T07:02:20.2338425Z ##[error]Could not find a file on the SonarQube server. Url: https://myurl.azurewebsites.net/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip
2022-09-08T07:02:20.2342400Z ##[error]Failed to update the SonarQube Scanner for MSBuild binaries. Check the server url, verify that the C# plugin is correctly installed on the SonarQube server and that the SonarQube server has been restarted.
2022-09-08T07:02:20.2344784Z ##[error]Pre-processing failed. Exit code: 1
2022-09-08T07:02:20.2596838Z ##[error]System.Exception: Unexpected exit code received from batch file: 1
2022-09-08T07:02:20.2600986Z at Microsoft.TeamFoundation.DistributedTask.Task.Internal.InvokeBatchScriptCmdlet.ProcessRecord()
2022-09-08T07:02:20.2603205Z at System.Management.Automation.CommandProcessor.ProcessRecord()
2022-09-08T07:02:20.2918529Z ##[error]PowerShell script completed with 1 errors.
2022-09-08T07:02:20.2948851Z ##[section]Finishing: [DEPRECATED] Fetch the Quality Profile from SonarQube
I have seen multiple posts with the answer to install a C# plugin, but I am unable to find it in the plugin list. For example I found this github page which contains a link to download the plugin, but the url is not valid anymore.

Related

TFS 2015 No agent can be found with following capabilities: msbuild, java, sonar qube

I've succeeded build with TFS 2015 Using MSbuild task. Now I've added Sonar qube tasks (SonarQube for MSBuild - Begin Analysis & End Analysis), find the Sonarqube settings below:
1. What is the Project key & how do we get it? I just gave Project Name as key.
Immediately on build trigger threw error/warning:
There are issues with the request or definition that may prevent the
build from running:No agent could be found with the following
capabilities: msbuild, java, msbuild, java. Queue the build anyway?
On Trigger Build further, Build failed with following error
No agent found in pool which satisfies the specified demands:
msbuild
java
msbuild
msbuild java Agent.Version -gtVersion 1.94.0
On cross-checking, i see that under General section in Build definition : Demand for MSBuild & java exists.
2. Am i correct or missing anything/settings?
I've configured Service Endpoint for SonarQube also. Find the screen shot below:
Please suggest on my error & queries highlighted.
When adding new task which required agent capabilities you need to add it to the agent.
The capabilities must be installed on the build servers where the agents are located.
UPDATE:
I just installed sonar qube on my test environment.
I got the same exception as you did, fixed it by installing java and msbuild .
Check,if those capabilities exists under your agent :

Sonarqube build for UWP-App failed

I habe a TFS-Server-Build (TFS 2017) on a Build-Agent with VS 2017. The first Buildstep (Prepare the Sonarqube analysis) and the build of the solution works fine. But i have a error at "Complete the SonarQube analysis":
2017-05-29T03:06:09.1933915Z ##[error]The SonarQube MSBuild integration failed: SonarQube was unable to collect the required information about your projects.
2017-05-29T03:06:09.1933915Z ##[error]Possible causes:
2017-05-29T03:06:09.1933915Z ##[error]1. The project has not been built - the project must be built in between the begin and end steps
2017-05-29T03:06:09.1933915Z ##[error]2. An unsupported version of MSBuild has been used to build the project. Currently MSBuild 12.0 upwards are supported
2017-05-29T03:06:09.1933915Z ##[error]3. The begin, build or end steps have not all been launched from the same folder
2017-05-29T03:06:09.1933915Z Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
2017-05-29T03:06:09.1933915Z ##[error]05:06:09.115 Post-processing failed. Exit code: 1
Can anyone help?
Kind regards
Sebastian
I am not familiar with TFS-Server-Build,, but the possible causes are mentioned.
Check the following link for more details on how to set it up properly
Just like the error mentioned this stands for SonarQube was unable to collect the required information about your projects
Even though you have installed MSBUILD 12 or above, you should make sure the Build agent is calling the right version.
And double check if the MSBuild.SonarQube.Runner and MSBuild is running from the same working directory. At .sonarqube/out folder the sonar-project.properties is getting created or not.

TFS - 409 Conflict during package upload

I have an issue with TFS (version 15.105.25910.0) during nuget's package upload:
******************************************************************************
Starting task: NuGet Publisher
******************************************************************************
Set workingFolder to default: C:\BuildSystem\TfsAgent\tasks\NuGetPublisher\0.2.21
C:\Windows\system32\chcp.com 65001
Active code page: 65001
Detected NuGet version 3.3.0.212 / 3.3.0
SYSTEMVSSCONNECTION exists true
C:\BuildSystem\TfsAgent\tasks\NuGetPublisher\0.2.21\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe push -NonInteractive C:\BuildSystem\TfsAgent\_work\6\s\myfolderPackage\bin\Release\mypackage.1.16.1905.nupkg -Source HunextPackages -ApiKey VSTS
Pushing mypackage 1.16.1905 to 'https://mytfsurl.com:444/tfs/DefaultCollection/_packaging/9ebd459f-9a02-456e-9243-c8d0f989c871/nuget/v2/'...
Failed to process request. 'Conflict'.
The remote server returned an error: (409) Conflict..
Error: C:\BuildSystem\TfsAgent\tasks\NuGetPublisher\0.2.21\node_modules\nuget-task-common\NuGet\3.3.0\NuGet.exe failed with return code: 1
Packages failed to publish
******************************************************************************
Finishing task: NuGetPublisher
******************************************************************************
System.Exception: Task NuGetPublisher failed. This caused the job to fail. Look at the logs for the task for more details.
at Microsoft.TeamFoundation.DistributedTask.Worker.JobRunner.Run(IJobContext jobContext, IJobRequest job, IJobExtension jobExtension, CancellationTokenSource tokenSource)
Worker Worker-bbe2b68d-3dfb-4b56-8546-bc2935a3ffe1 finished running job bbe2b68d-3dfb-4b56-8546-bc2935a3ffe1
******************************************************************************
Finishing Build
******************************************************************************
I use package management on TFS and remote server returned 409 conflict, but in the list of packages I do not see my "mypackage 01.16.1905".
Where's physically stored the package?
Thanks.
For trouble shooting, your could try to run it manually in an ordinary PowerShell console instead of running it in a build step.
And according to your log, Looks like you are using nuget 3.3. Try to use nuget 3.5 or higher to use the TFS Packaging feature due to some auth fixes that went into 3.5. You'll find the version toggle inside the Nuget task options in your build definition.
Try to update to 3.5 to see if you still have problems. Also make sure you don't have any auth issue which nuget could use the creds to send to the server.
Update
It's not possible to overwrite existing packages on TFS. Nuget.exe allows wildcards for push, so you could use nuget push *.nupkg -Source ....For this , it will publish the latest version.

SonarQube 6.0 doesn't find project on TFS 2015

I have a ASP.Net Web Application using .Net Framework 4.5.1 and it's building on the TFS Buildserver (on premise), but SonarQube doesn't perform the analysis. All other buildsteps are successfull. SonarQube 6.0 is a fresh installation, the Runner was installed around a year ago.
The necessary .Net Frameworks for SonarQube and Builds are installed on the build machine.
On a WebAPI Project the analyzer works like a charm. What could it be?
******************************************************************************
Starting task: Fetch the Quality Profile from SonarQube
******************************************************************************
Executing the powershell script: C:\Agents\Agent1\tasks\SonarQubePreBuild\1.0.34\SonarQubePreBuild.ps1
SonarQube Scanner for MSBuild 1.1
Default properties file was not found at C:\Agents\Agent1\tasks\SonarQubePreBuild\1.0.34\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
SonarQube Scanner for MSBuild Begin Step 2.1
14:41:58.919 Default properties file was not found at C:\Agents\Agent1\_work\14\.sonarqube\bin\SonarQube.Analysis.xml
14:41:58.929 Updating build integration targets...
14:41:58.939 Fetching analysis configuration settings...
14:41:59.039 Generating rulesets...
14:42:00.119 Provisioning analyzer assemblies...
14:42:00.119 Installing required Roslyn analyzers...
Pre-processing succeeded.
******************************************************************************
Finishing task: SonarQubePreBuild
******************************************************************************
... building solution, publish symbols & drop ...
******************************************************************************
Starting task: Finish the analysis and upload the results to SonarQube
******************************************************************************
Executing the powershell script: C:\Agents\Agent1\tasks\SonarQubePostTest\1.0.36\SonarQubePostTest.ps1
SonarQube Scanner for MSBuild 1.1
Default properties file was not found at C:\Agents\Agent1\tasks\SonarQubePreBuild\1.0.34\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild End Step 2.1
14:40:50.486 WARNING: Failed to find the code coverage command line tool. Possible cause: Visual Studio is not installed, or the installed version does not support code coverage.
The exclude flag has been set so the project will not be analyzed by SonarQube. Project file: C:\Agents\Agent1\_work\14\s\TdbWeb\TdbWeb\TdbWeb.csproj
No analysable projects were found. SonarQube analysis will not be performed. Check the build summary report for details.
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
14:40:50.526 Creating a summary markdown file...
Post-processing failed. Exit code: 1
Unexpected exit code received from batch file: 1
The build was not set to fail if the associated quality gate fails.
******************************************************************************
Finishing task: SonarQubePostTest
******************************************************************************
You need Visual Studio Enterprise edition for code coverage and you are using VS Pro. Have a look at this page and expand the 'tesing tools' section. Code coverage is only listed for the Enterprise edition.

Jenkins MSBuild SonarQube Runner 1.0.2 projectinfo.xml file not found

I'm having trouble running the sonarqube msbuild runner v1.0.2 in jenkins.
The build runs fine, but the plugin doesn't seem to import the sonar targets correctly.
Here's the logs when the sonar build kicks off:
[workspace] $C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe begin /k:my.project /n:myprojectname /v:1.0 /d:sonar.host.url=http://1.1.1.1:9000/
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Pre-processing started.
Preparing working directories...
Checking for updates...
MSBuild SonarQube Runner Pre-processor 1.0.2.0
10:17:18.025 Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
10:17:18.056 Updating build integration targets...
10:17:18.072 Fetching analysis configuration settings...
10:17:21.332 Generating rulesets...
Pre-processing succeeded.
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
Executing the command cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic myprojectname.sln " && exit %%ERRORLEVEL%% from C:\.jenkins\jobs\Technology - WWW - Content Store Client\workspace
[workspace] $ cmd.exe /C " C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Development /t:Clean,Build /tv:14.0 /p:VisualStudioVersion=14.0 /m:1 /fl2 /flp2:verbosity=diagnostic ContentStoreClientSolution.sln " && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine version 4.6.81.0...
And here when if finishes:
[workspace] $ C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\MSBuild.SonarQube.Runner.exe end
MSBuild SonarQube Runner Bootstrapper 1.0.2.0
Default properties file was found at C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Loading analysis properties from C:\.jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\MS_Build_Runner_1.0.2\SonarQube.Analysis.xml
Post-processing started.
No ProjectInfo.xml files were found. Possible causes: you specified an invalid build configuration or the custom MSBuild analysis targets were not imported.
MSBuild SonarQube Runner Post-processor 1.0.2.0
Generation of the sonar-properties file failed. Unable to complete SonarQube analysis.
10:21:04.257 Creating a summary markdown file...
Post-processing failed. Exit code: 1
ERROR: Execution of MSBuild SonarQube Runner failed (exit code 1)
The plugin installs itself int he tools subfolder of jenkins. But, looking in the project workspace, I can see a folder called .sonar that appears to have all the correct files and targets etc in it.
Any ideas on why the build is failing?
You need to use MSBuild 12 at least (version 14, shipping with VS 2015 will give you more accurate analysis results with version 1.1 of the SonarQube Scanner for MSBuild & C# Plugin 4.4).
The ImportsBefore targets are not deployed for MSBuild 4.0 - which is why no information is being collected during your MSBuild execution. We're not going to add support for MSBuild 4.0 or earlier versions.
Note that in the upcoming SonarQube Scanner for MSBuild 1.1 version, the error message mentioning ProjectInfo.xml has been largely improved to let you know about the potential root causes: See https://jira.sonarsource.com/browse/SONARMSBRU-180

Resources