We need more information in order to help you, could you please:
Run the pipeline in debug mode (With diagnostics logs) and send us the output
Tell us whether you are using any kind of proxy or firewall to access SQ? And if yes, what your proxy configuration looks like (Azure agent running behind a proxy, HTTP(S)_PROXY env variable, firewall…)
Verify that you are not mixing up task versions
You should have
task: SonarQubePrepare@5
task: SonarQubeAnalyze@5
task: SonarQubePublish@5
Tell us if the service connection that you set up for SQ using http or https?
We’ve been affected by this last update made to the “Publish Quality Gate Result” task as well.
In our case the errors are:
##[error][SQ] API GET '/api/metrics/search' failed, error is Invalid response body while trying to fetch http://sonar.xpto.br/api/metrics/search?f=name&ps=500: Premature close
##[error][SQ] API GET '/api/ce/task' failed, error is Invalid response body while trying to fetch http://sonar.xpto.br/api/ce/task?id=AYvdkun-AMdy9jUKxjR_: Premature close
##[error][SQ] Could not fetch task for ID 'AYvdkun-AMdy9jUKxjR_'
We are also experiencing similar issues using SonarQbe ADO task v5.18.0 - 5.18.2. The tasks used to work with no additional proxy setup required.
SonarQubePrepare task fails with
##[error][SQ] API GET ‘/api/server/version’ failed, error is Response timeout while trying to fetch …
This can be fixed by https proxy setting through SONAR_SCANNER_OPTS
SonarQubeAnalyze task works with only without the proxy settings, so no SONAR_SCANNER_OPTS. Otherwise it can’t reach the server.
SonarQubePublish doesn’t work with or without the proxy setting. It always fails with:
##[error][SQ] API GET ‘/api/metrics/search’ failed, error is Response timeout
##[error][SQ] API GET ‘/api/server/version’ failed, error is Response timeout
This is a major blocker for our team, I believe more teams working behind corporate proxies are also affected.
@Michal_Chudziak : can you please attach the DEBUG logs (sonar.verbose=true) for us to review? This will help us check what corrections will be needed.
We are also affected by this update.Our pipelines are failing with the attached error.
Sonarqube version: Community Edition Version 9.9
SonarScanner for MsBuild 5.14
Hi team, we are using SonarQube v10.2.1 and we also encountered a similar issue. Can you please assist? Thanks
##[debug][SQ] Task status:PENDING
##[debug][SQ] Waiting for task 'AYvrVIW9aqLrN4rOFAIA' to complete.
##[debug][SQ] API GET: '/api/ce/task' with full URL "{companyurl}/api/ce/task?id=AYvrVIW9aqLrN4rOFAIA" and query "{"id":"AYvrVIW9aqLrN4rOFAIA"}"
##[debug]Agent.ProxyUrl=undefined
##[debug]Not using a proxy agent
##[debug][SQ] API GET '/api/ce/task' failed, error is Invalid response body while trying to fetch {companyurl}/api/ce/task?id=AYvrVIW9aqLrN4rOFAIA: Premature close
##[error][SQ] API GET '/api/ce/task' failed, error is Invalid response body while trying to fetch {companyurl}/api/ce/task?id=AYvrVIW9aqLrN4rOFAIA: Premature close
##[debug]Processed: ##vso[task.issue type=error;][SQ] API GET '/api/ce/task' failed, error is Invalid response body while trying to fetch {companyurl}/api/ce/task?id=AYvrVIW9aqLrN4rOFAIA: Premature close
##[debug][SQ] Publish task error: [SQ] Could not fetch task for ID 'AYvrVIW9aqLrN4rOFAIA'
##[debug]task result: Failed
##[error][SQ] Could not fetch task for ID 'AYvrVIW9aqLrN4rOFAIA'
##[debug]Processed: ##vso[task.issue type=error;][SQ] Could not fetch task for ID 'AYvrVIW9aqLrN4rOFAIA'
##[debug]Processed: ##vso[task.complete result=Failed;][SQ] Could not fetch task for ID 'AYvrVIW9aqLrN4rOFAIA'
We are actively working on releasing a version that addresses your issues,
However, we are having trouble reproducing your issues, which makes us believe there is something different between our testing environment and yours,
We would need to know:
How are you passing proxy configuration to the agent?
Is it through HTTP_PROXY, HTTPS_PROXY, both? Is your SQ reached through http or https? (If it is http, HTTP_PROXY should be set, if it is https, HTTPS_PROXY should be set). Are you using the NO_PROXY environment variable?
We need the diagnostics logs for the Prepare, Analyze and Publish tasks
You can generate these logs by:
Navigating on the pipeline
Clicking “Run pipeline” and tick the “Enable system diagnostics” checkbox at the bottom of the side panel which should open
Actually run the pipeline
You can download logs and send them to us
In the meantime, even though that is not optimal, you may want to temporarily disable the publish step from your pipeline while we publish a new patch release,
We were able to reproduce your failure in specific setups where proxy variables were not always set: For instance, if you are reaching an https SQ through a proxy and you are only passing HTTP_PROXY, not HTTPS_PROXY.
We just released 5.18.3 which we hope will fix your issue. If after this you still encounter issues, please refer to my previous message to help us dig into it,
Upon a rerun of the same pipeline, the prepare stage succeeded but now it failed on the analysis stage.
Please find attached the logs for the analyse stage.
Versions 5.18.2 and 5.18.3 seem to work fine for us.
Our Azure DevOps agents are running behind a proxy and our SonarQube server is hosted on-premises (currently being accessed by Azure DevOps agents with HTTP).
After the original breaking change made to the Publish task (and its subsequent fixes) it was required for us to add our SonarQube endpoint in the agents’ .proxybypass files in order for the Publish task to communicate properly with it.
One thing strange I noticed in the last version was that it prints “##[debug]Not using a proxy agent” in the Publish task, even when we had not inserted our on-prem SonarQube’s URL in the Azure DevOps agent’s .proxybypass file…
Hello @KennyRogers , your failure does not seem related to our update. If you have timeout issues, you may want to consider adding sonar.ws.timeout to the extra properties of the prepare task
@mrinardo , happy to hear that your issue was resolved
it prints “##[debug]Not using a proxy agent ” in the Publish task, even when we had not inserted our on-prem SonarQube’s URL in the Azure DevOps agent’s .proxybypass file…
We no longer read Azure proxy configuration to make requests (technically, that is recommended by Azure, but in order to keep compatibility with <5.18, we choosed to revert this change). So, the .proxybypass file should have no effect on whether the proxy is used within the extension.