简体   繁体   中英

How to configure SonarQube, Sonar Runner, GitLab and Jenkins to obtain Continuous Integration

I have already set up SonarQube, Sonar Runner and Jenkins latest versions on my local machine (Ubuntu 14.04 LTS desktop version).

I want to know how we can integrate these with git (GitHub or GitLab). When we push the code to git we want to previously analyse it and after this automatically commit it into Git.

What should I do?

You should have a look at the sonar-gitlab-plugin project : https://gitlab.talanlabs.com/gabriel-allaigre/sonar-gitlab-plugin

Edit: As for the GitHub plugin mentioned in a previous answer, the GitLab plugin will analyze new code that is pushed to the Git repository. So the analysis happen after having commited and pushed your work to the repository.

The functionality you describe does not exist.

What does exist is the ability to analyze a pull request, using the SonarQube GitHub plugin . Even after that analysis, it's up to you to accept or reject the pull request; the plugin only comments on it.

First of all, I would use some Git workflow to share between the team (Github, GitLab, GitFlow, ...). Later on I would protect master branch (and also develop if you are using GitFlow) so only administrators can modify the mainline stream. And finally you can integrate jenkins (or Gitlab CI), sonar and nexus before the Merge Requests are done using webhooks. See GitLab plugin for further information on how to integrate this with GitLab and Jenkins. Sonar can be easily integrated with Jenkins installing the Sonar plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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