Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 8.6
-
Component/s: Branch & PR, Quality Gate
-
Labels:
-
Edition:Developer
-
Production Notes:None
Description
SonarQube decoration on GitLab MR is using the GitLab API :
https://[mygitlab]/api/v4/projects/${project_id}/mergerequests/${mr_id}/notes?body=xxxxx
The body query parameter can be too long for the GitLab embedded Nginx reverse proxy, with the default configuration.
The visible effect of this is that the SonarQube background task is looping forever on the MR decoration, without ever failing (no timeout).
For on-prem GitLab instance, the fix for users is to add to the gitlab.rb configuration file this configuration :
nginx['custom_gitlab_server_config'] = "large_client_header_buffers 4 32k;\nhttp2_max_field_size 32k;\nhttp2_max_header_size 64k;\n"
which allows a bigger URL.
The definitive fix would be to fail properly on the SonarQube side, with a proper error. The same query with curl raise a correct error :
414 Request-URI Too Large
SonarQube should be able to detect such an error and fail accordingly, with the advice to increase the URL limit on the Gitlab size.
For GitLab.com, there is no workaround yet. But the limit has already been increased a bit, so the issue has not been reported yet. The issue will happen if a user has a very long Sonarqube URL (because of the links we put in the markdown).
From the community: https://community.sonarsource.com/t/gitlab-ci-loop-of-empty-posts-for-pr-decoration-when-quality-gate-fails/19137/33, and credits to Antoine DAVID for the suggested workaround.