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.
The error messages are:
[error][SQ] Could not fetch metrics
[error][SQ] Could not fetch task for ID 'FWK9NiOFibiMfA2L0BHo'
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.
Seems it's an issue with the SonarQube VSTS Extensions:
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.
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
Add a new row after row 22:
options.auth.pass = "";
Just refer to this similar thread for details : Unable to integrate SonarQube analysis results with VSTS Build Summary
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With