【问题标题】:401 Unauthorized Sonarqube Analysis with TFS2017 [closed]使用 TFS2017 进行 401 未经授权的 Sonarqube 分析 [关闭]
【发布时间】:2017-06-15 09:58:18
【问题描述】:

我设置了一个 SonarQube 服务器,并将 BuildTask 步骤包含在 TFS2017 构建过程中。 TFS 是一种本地设置。

在“完成 SonarQube 分析”构建步骤中,我收到以下错误:

2017-01-30T08:54:30.7388183Z 09:54:30.676  Post-processing succeeded.
2017-01-30T08:54:32.1607278Z ##[error]System.Management.Automation.CmdletInvocationException: {"err_code":401,"err_msg":"Unauthorized"} ---> System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.
2017-01-30T08:54:32.1607278Z    bei Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
2017-01-30T08:54:32.1607278Z    bei Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
2017-01-30T08:54:32.1607278Z    --- Ende der internen Ausnahmestapelüberwachung ---
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-30T08:54:32.1607278Z    bei Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2017-01-30T08:54:32.1763500Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
2017-01-30T08:54:32.1763500Z ##[section]Finishing: Complete the SonarQube analysis

分析完成后,我假设这是 SonarQube 之后完成的某种日志记录。

构建代理安装在服务器 A 上,SonarQube 安装在服务器 B 上。“准备步骤”构建任务完成没有错误,所以我假设基本的 SonarQube 设置是好的。我安装了 SonarQube 5.6.5 LTS,SonarQube.Analysis.xml 中提供的 Sonar User 是默认的 admin/admin 用户。

有什么建议吗?

【问题讨论】:

    标签: tfs sonarqube


    【解决方案1】:

    构建任务不使用 SonarQube.Analysis.xml 中的身份验证属性,您需要在 TFS 中的 SonarQube 端点中指定身份验证令牌: https://docs.sonarqube.org/display/SCAN/SonarQube+Endpoint

    这里有一篇关于如何从 SonarQube 获取令牌的文章: https://docs.sonarqube.org/display/SONAR/User+Token

    如果您首先取消注释,请不要忘记在 SonarQube.Analysis.xml 中再次注释 sonar.login 和 sonar.password 属性。

    【讨论】:

    • 感谢您的回复,它起作用了-尽管我忘记在 SonarQube.Analysis.xml 中评论 sonar.login 和 sonar.password 属性,这首先使其无法成功。我会将此添加到您的答案中。
    • 感谢您的评论 :) 我将向我们的错误跟踪器添加一个新问题,必须从 XML 中删除登录名/密码属性似乎需要注意。
    • 很高兴知道。如果它是公开的,您可以将链接放在这里,以便我们跟踪问题。我的声纳设置还有另一个问题here。非常感谢您的帮助:)
    猜你喜欢
    • 2017-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-06
    • 2018-05-19
    • 2020-06-11
    相关资源
    最近更新 更多