feat: Pull Request support if using SonarQube community version with community-branch-plugin installed #55
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello again 😄
We have another Pull Request as we identified that this tool currently is unable to determine the correct issues and Quality Gate data when using SonarQube community version with the community-branch-plugin installed.
The issue is, that if the plugin is installed and enabled in SonarQube, the SonarQube API requires the Pull/Merge Request ID for which the issues and quality gate should be retrieved. The Pull/Merge Request ID can be specified by the query parameter
&pullRequest=[ID]
.Therefore we've added a new flag (
--sonar-branch-plugin
or-b
), with which the community-branch-plugin support can be enabled in this tool. Then thepullRequest
query parameter (we've added a TypeScript type for this matter) will be appended to each SonarQube API request and the Quality Gate Pull/Merge Request decoration comment URLs. We also needed to increase theINTERVAL_SECONDS
variable to 5 minutes to be able to retrieve the newly created issues in SonarQube as there is some delay caused by our GitLab CI/CD jobs. 1 minute is not enough. Maybe we should make this configurable too?I know this is a fairly large change. We've tested the changes with our self-hosted GitLab and SonarQube 10.3 with the community-branch-plugin installed in version 1.16.1 (I hope that official support of SonarQube 10.3 doesn't take too long 🤞). It'd be great if you could test our changes on your end, if you're interested in merging this pull request :)