简体   繁体   English

是否可以集成SonarQube,Jenkins和GitLab(全部在docker中)?

[英]Is it possible to integrate SonarQube, Jenkins and GitLab (all in dockers)?

Currently, I am working in a quality process so as to ensure that the code is acceptable. 目前,我正在制定质量流程,以确保代码可以接受。 For that, I'm integrating Jenkins, SonarQube and GitLab, which are running in different servers (actually they are in different docker containers). 为此,我正在集成Jenkins,SonarQube和GitLab,它们在不同的服务器上运行(实际上它们在不同的Docker容器中)。

The idea is to check with SonarQube everytime the code is pushed against GitLab and block commits, merges, and so on, whether SonarQube has not passed. 想法是每次将代码推入GitLab并阻止提交,合并等等时,都要通过SonarQube进行检查,以确定SonarQube是否未通过。

I have already integrated Jenkins with SonarQube, but Jenkins checks the code inside his workspace, so imagine a situation where a developer in his laptop needs to push his changes. 我已经将Jenkins与SonarQube集成在一起,但是Jenkins会检查工作区中的代码,因此,设想一下笔记本电脑中的开发人员需要推动其更改的情况。

My conceptual question is simple: Is it possible to integrate these technologies in order to do this? 我的概念性问题很简单:是否可以集成这些技术来做到这一点? And, if the question is yes, which steps are necessary? 而且,如果问题是肯定的,那么需要哪些步骤?

PD: I don't need to see code, configuration files,and so on. PD:我不需要查看代码,配置文件等。 I just need something like: 我只需要以下内容:

  1. Configure SonarQube to work with Jenkins 配置SonarQube以与Jenkins一起使用
  2. Do an script so as to copy that file in that folder, 做一个脚本,以便将该文件复制到该文件夹​​中,
  3. ... ...

First, in docker means each tool is in its own container. 首先,在docker中意味着每个工具都在其自己的容器中。
They only need to see each other through the network, which is where a Docker Engine in Swarm mode comes in. 他们只需要通过网络相互查看,这就是Swarm模式下的Docker引擎的出现。

Second "configure Jenkins to work with SonarQube"... that is what I have done in my shop, and there isn't much to it. 第二个“配置Jenkins与SonarQube一起使用” ...这就是我在商店中所做的,并且没有太多的事情。
Once the Jenkins SonarQube plugin is installed, and the address for the SonarQube server entered , you can configure your job and call sonar (for instance with maven: $SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL ) 一旦安装了Jenkins SonarQube插件 ,并输入了SonarQube服务器地址 ,就可以配置作业并调用声纳(例如,使用maven: $SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL

The analysis done in the Jenkins workspace will then be published in the SonarQube server. 然后,将在Jenkins工作区中完成的分析将在SonarQube服务器中发布。

A swarm server is the more modern version of this 2015 docker-compose.yml file from the marcelbirkner/docker-ci-tool-stack project. 群体服务器是marcelbirkner/docker-ci-tool-stack项目中此2015 docker-compose.yml文件marcelbirkner/docker-ci-tool-stack版本。

https://github.com/marcelbirkner/docker-ci-tool-stack/raw/master/screenshots/docker-ci-tools.png

The idea remains the same though: each element is isolated in its own container. 但是,这个想法仍然保持不变:每个元素都隔离在自己的容器中。

我自己还没有尝试过,但是在您的设置中https://gitlab.talanlabs.com/gabriel-allaigre/sonar-gitlab-plugin可能很有趣。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM