问题
I am using GitLab with SonarQube executed by Jenkins. I want prevent merge requests from being accepted if SonarQube has reported any issues.
Any ideas for Gitlab CE or EE?
回答1:
Gitlab CI offers two ways to prevent merge requests, if build fails or if there is unresolved discussion.
To start please configure a Jenkins plugin following this tutorial.
Now that you have the gitlab-jenkins-ci integration and gitlab trigerrs the jenkins build you have to enable Only allow merge requests to be merged if the build succeeds
in the project settings in gitlab and either install SonarQube build breaker plugin or use the rest api.
The method not involving build breaking would be to use gitlab SonarQube plugin however currently it does not support making comments on merge requests so you'd have to either modify the plugin or make a workaround using the gitlab api.
来源:https://stackoverflow.com/questions/41616144/prevent-accepting-merge-requests-on-sonar-issues