Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error when queing build with sonarqube. Unauthorized

I am trying to integrate sonarqube with TFS, I created a build definition with only one step, the sonar qube integration, based on this tutorial:

  1. https://blogs.msdn.microsoft.com/visualstudioalm/2015/08/24/build-tasks-for-sonarqube-analysis/

I know my sonarqube is already setup, because I can access it through the browser and the database is correctly setup.

However I am getting this error:

14:45:53.684  Default properties file was not found at C:\BuildAgents\DefaultBuildAgent\5\.sonarqube\bin\SonarQube.Analysis.xml
14:45:53.762  Updating build integration targets...
14:45:53.84  Fetching analysis configuration settings...
Unhandled Exception: System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at System.Net.WebClient.DownloadString(String address)
at SonarQube.TeamBuild.PreProcessor.WebClientDownloader.Download(String url)
at SonarQube.TeamBuild.PreProcessor.SonarWebService.GetProperties(String projectKey, String projectBranch)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.FetchArgumentsAndRulesets(ISonarQubeServer server, ProcessedArgs args, TeamBuildSettings settings, IDictionary`2& serverSettings, AnalyzerSettings& analyzerSettings)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.DoExecute(ProcessedArgs args)
at SonarQube.TeamBuild.PreProcessor.TeamBuildPreProcessor.Execute(String[] args)
at SonarQube.TeamBuild.PreProcessor.Program.Main(String[] args)
Pre-processing succeeded.
Unexpected exit code received from batch file: 255
******************************************************************************
Finishing task: SonarQubePreBuild
******************************************************************************
Task SonarQubePreBuild failed. This caused the job to fail. Look at the logs for the task for more details.
******************************************************************************
Finishing Build
******************************************************************************
Worker Worker-28c6fdb7-9350-4b65-bbba-0e9aab5e0e83 finished running job 28c6fdb7-9350-4b65-bbba-0e9aab5e0e83
like image 404
Luis Valencia Avatar asked Oct 29 '22 21:10

Luis Valencia


1 Answers

You need to specify the authentication token in the SonarQube service endpoint in TFS: click!

To obtain a user token in SonarQube follow these steps

Be sure the sonar.login and sonar.password properties in SonarQube.Analysis.xml are commented out, otherwise the token won't be used.

like image 93
phifi Avatar answered Jan 02 '23 21:01

phifi