使用sonarqube排队构建时出错。擅自

时间:2016-08-31 19:51:31

标签: tfs sonarqube azure-devops

我正在尝试将sonarqube与TFS集成,我根据本教程创建了一个只有一步的声纳qube集成的构建定义:

  1. https://blogs.msdn.microsoft.com/visualstudioalm/2015/08/24/build-tasks-for-sonarqube-analysis/
  2. 我知道我的sonarqube已经设置好了,因为我可以通过浏览器访问它并正确设置数据库。

    但是我收到了这个错误:

    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
    

1 个答案:

答案 0 :(得分:2)

您需要在TFS中的SonarQube服务端点中指定身份验证令牌:click!

要在SonarQube中获取用户令牌,请关注these steps

确保SonarQube.Analysis.xml中的sonar.login和sonar.password属性已被注释掉,否则将不会使用该令牌。