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

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

问题描述

在TFS上,我无法运行taks发布分析结果"以在TFS网页上发布Quality Gate.其他任务在SonarQube上准备分析"和运行代码分析"成功运行.

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软件包"request"(至少最新版本)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构建计算机上手动编辑扩展名来解决此问题.要编辑的文件是:< build位置> \ _ tasks \ SonarQubePublish_291ed61f-1ee4-45d3-b1b0-bf822d9095ef \ 4.0.0 \ common \ helpers \ request.js

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>\_tasks\SonarQubePublish_291ed61f-1ee4-45d3-b1b0-bf822d9095ef\4.0.0\common\helpers\request.js

在第22行之后添加新行:

Add a new row after row 22:

options.auth.pass = "";

有关详细信息,请参见此类似主题:无法将SonarQube分析结果与VSTS Build Summary集成

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天全站免登陆