401使用TFS 2015和SonarQube 5.6.1进行未经授权的错误分析

时间:2016-09-07 20:46:35

标签: .net sonarqube

我们使用的是On Premises TFS 2015 Update 2服务器,使用TFS版本控制。目前,我们在主分析服务器上运行SonarQube 5.5,并且每天都在执行分析。我们没有在SonarQube服务器上使用LDAP,并且每个人组都有权执行分析。

然而,我将我的测试服务器升级到SonarQube 5.6.1,以准备更新的FXCop规则以及规则的正确分类(错误,漏洞等...)。但是,当我尝试运行分析时,任务"从SonarQube获取质量配置文件"因(401)未经授权的错误而失败。我有以下任务的控制台输出。

我能够将此更改发现到5.6版。这是导致我的授权问题的原因吗? https://jira.sonarsource.com/browse/SONAR-7640

当我查看自动生成的SonarQube.Analysis.xml文件时,sonar.host.url,sonar.login和sonar.password条目是正确的。它在文件中的用户是sonarqube中的管理员,并且有权执行分析。

我也在github上遇到了这个问题。 https://github.com/Microsoft/vsts-tasks/issues/1851

为VSTS添加了一个新选项,以解决Sonar因401 Unauthorized错误而失败的问题。但是,这似乎是分析过程结束的一个问题,因为它无法创建摘要报告。

如果我带上我的测试服务器,并将运行BACK的Windows服务切换到我的SonarQube 5.5副本,它将在没有任何授权错误的情况下工作。

sonarqube Windows服务和TFS Build Agent作为我的测试计算机和TFS管理员的管理员用户运行。

任务输出失败:

Executing the powershell script: D:\Agent\tasks\SonarQubePreBuild\1.0.34\SonarQubePreBuild.ps1
SonarQube Scanner for MSBuild 1.1
Default properties file was found at D:\Agent\tasks\SonarQubePreBuild\1.0.34\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from D:\Agent\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
Loading analysis properties from D:\Agent\tasks\SonarQubePreBuild\1.0.34\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Updating build integration targets...
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.
System.Exception: Unexpected exit code received from batch file: 255
  at Microsoft.TeamFoundation.DistributedTask.Task.Internal.PowerShell.InvokeBatchScriptCmdlet.ProcessRecord()
  at System.Management.Automation.CommandProcessor.ProcessRecord()

1 个答案:

答案 0 :(得分:2)

我能够通过删除构建代理服务上的用户并再次添加它来实现此功能,但确保服务的用户ID全是小写字母。老实说,我所做的一切,现在都在努力。

相关问题