问题描述
我将GitLab与Jenkins执行的SonarQube结合使用.如果SonarQube报告了任何问题,我想防止合并请求被接受.
I am using GitLab with SonarQube executed by Jenkins. I want prevent merge requests from being accepted if SonarQube has reported any issues.
对Gitlab CE或EE有任何想法吗?
Any ideas for Gitlab CE or EE?
推荐答案
如果构建失败或存在未解决的讨论,Gitlab CI提供了两种防止合并请求的方法.首先,请按照本教程配置一个Jenkins插件. .现在您已经有了gitlab-jenkins-ci集成并且gitlab trigerrs jenkins构建了,您必须在gitlab的项目设置中启用Only allow merge requests to be merged if the build succeeds
并安装 SonarQube构建断路器插件或使用休息api .
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.
不涉及构建中断的方法是使用 gitlab SonarQube插件,但是当前它不支持对合并请求进行注释,因此您必须修改插件或使用gitlab 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.
这篇关于阻止接受有关声纳问题的合并请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!