Sonarqube v.4 TFS 任务“发布分析结果"抛出错误“无法获取指标" [英] Sonarqube v.4 TFS task "Publish Analysis Result" throw error "Could not fetch metrics"

查看:25
本文介绍了Sonarqube v.4 TFS 任务“发布分析结果"抛出错误“无法获取指标"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 TFS 上,我无法运行任务发布分析结果"以在 TFS 网页上发布质量门.其他任务Prepare analysis on SonarQube"和Run Code Analysis"运行成功.

On TFS, I am not being able to run the taks "Publish Analysis Result" to publish Quality Gate on TFS web page. The other tasks "Prepare analysis on SonarQube" and "Run Code Analysis" runs successfully.

错误信息是:

[错误][SQ] 无法获取指标

[error][SQ] Could not fetch metrics

[错误][SQ] 无法获取 ID 'FWK9NiOFibiMfA2L0BHo' 的任务

[error][SQ] Could not fetch task for ID 'FWK9NiOFibiMfA2L0BHo'

尽管有错误消息,当我访问 url http://localhost:9000/api/ce/task?id=FWK9NiOFibiMfA2L0BHo 我收到一个包含任务信息的 json 响应.

Despite the error message, when I access the url http://localhost:9000/api/ce/task?id=FWK9NiOFibiMfA2L0BHo I get a json response with the task information.

推荐答案

似乎是 SonarQube VSTS 扩展的问题:

Seems it's an issue with the SonarQube VSTS Extensions:

SonarQube 扩展使用基本身份验证与SonarQube API 端点,并使用令牌作为用户名,以及密码为空.npm 包请求"(至少是最新版本2.83.0),不允许空密码并返回auth()收到无效的用户或密码".

The SonarQube extension uses basic authentication to communicate with the SonarQube API endpoint, and uses the token as username, and password as null. The npm package 'request' (at least latest version 2.83.0), does not allow null passwords and returns 'auth() received invalid user or password'.

要解决此问题,应将密码设置为空字符串.

To fix it, the password should be set to an empty string instead.

在 SonarSource 修复 VSTS 插件之前,您可以解决通过在 VSTS 构建机器上手动编辑扩展来发布.要编辑的文件是:

Until the VSTS plugin is fixed by SonarSource, you can workaround the issue by manually editing the extension on your VSTS build machine. The file to edit is: <build location>\_tasksSonarQubePublish_291ed61f-1ee4-45d3-b1b0-bf822d9095ef4.0.0commonhelpers equest.js

在第 22 行之后添加一个新行:

Add a new row after row 22:

options.auth.pass = "";

有关详细信息,请参阅此类似线程:无法将 SonarQube 分析结果与 VSTS 构建摘要集成

Just refer to this similar thread for details : Unable to integrate SonarQube analysis results with VSTS Build Summary

这篇关于Sonarqube v.4 TFS 任务“发布分析结果"抛出错误“无法获取指标"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆