We recently upgraded to SonarQube Community Edition Version 7.1 (build 11001). We are also using the TFS SonarQube extension Version 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. It doesn't happen on the Windows build agent. What's also interesting is that the output from the "Run Code Analysis" step seems to indicate a different task 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. 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".
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. The task reads the contents of those files to get the URL and Task ID for the SQ analysis. The second was left over from an older build and contained an invalid task ID. Removing that file fixed the issue.