简体   繁体   English

Sonarqube v.4 TFS任务“发布质量门结果”引发错误“无法获取ID的任务”

[英]Sonarqube v.4 TFS task “Publish Quality Gate Result” throws error “Could not fetch task for ID”

We recently upgraded to SonarQube Community Edition Version 7.1 (build 11001). 我们最近升级到SonarQube社区版7.1版(内部版本11001)。 We are also using the TFS SonarQube extension Version 4.3.1. 我们还使用了TFS SonarQube扩展版本4.3.1。 The "Publish Quality Gate Result" build step fails with the message: “发布质量门结果”构建步骤失败,并显示以下消息:

[SQ] API GET '/api/ce/task' failed, status code was: 404
[SQ] Could not fetch task for ID 'AWRg8urbC5nyQrURbDKL'

This only happens on the linux build agent. 这仅在linux build agent上发生。 It doesn't happen on the Windows build agent. Windows构建代理不会发生这种情况。 What's also interesting is that the output from the "Run Code Analysis" step seems to indicate a different task ID: 有趣的是,“运行代码分析”步骤的输出似乎指示不同的任务ID:

=========== Run Code Analysis Output ===========
More about the report processing at http://sonarqube:9000/api/ce/task?id=AWSFWzxYmaH45QFNcZ_C

=========== Publish Quality Gate Result Output ===========
[SQ] Could not fetch task for ID 'AWRg8urbC5nyQrURbDKL'

The URL from the Code Analysis step is valid and returns a json response containing all of the data about the task. 来自“代码分析”步骤的URL有效,并返回一个json响应,其中包含有关任务的所有数据。 If I replace the ID in the URL with the ID from the Publish step, I get an error json response with the message "No activity found for task". 如果用发布步骤中的ID替换URL中的ID,则会收到错误json响应,并显示消息“找不到任务的活动”。

How can this be fixed so the build step doesn't fail? 如何解决此问题,以使构建步骤不会失败?

UPDATE - FIXED 更新-已修复

After setting system.debug=true on the build, I noticed that there were two report-task.txt files that were being processed by the Publish Quality Gate Result Task: /agent/_work/2/.sonarqube/out/.sonar/report-task.txt and /agent/_work/2/s/.scannerwork/report-task.txt . 在构建中设置system.debug=true后,我注意到有两个report-task.txt文件正在由“发布质量门结果任务”处理: /agent/_work/2/.sonarqube/out/.sonar/report-task.txt/agent/_work/2/s/.scannerwork/report-task.txt The task reads the contents of those files to get the URL and Task ID for the SQ analysis. 任务读取这些文件的内容,以获取SQ分析的URL和任务ID。 The second was left over from an older build and contained an invalid task ID. 第二个是从旧版本中遗留下来的,其中包含无效的任务ID。 Removing that file fixed the issue. 删除该文件可解决此问题。

This error can occur if the build directory contains a report-task.txt file left over from a prior build. 如果构建目录包含先前构建遗留下来的report-task.txt文件,则会发生此错误。 Make sure there are no report-task.txt files in the build directory by setting the Clean option to true in the build configuration. 通过在构建配置中将Clean选项设置为true ,确保在构建目录中没有report-task.txt文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM