背景 ソースコードをcommit/pushした際の自動レビューと、コード品質の可視化のためにSonarQubeを導入することになった。 既にソースコードはGitLabで管理しており、GitLab-CIを使ってビルドやテスト、デプロイの自動化まで実装済み。 今さら感はあるが、GitLabとSonarQubeの連携方法について調べてみた。 Jenkinsは必要か? 調べていくと、どの事例もJenkinsを間に挟んでGitLabとSonarQubeを連携させている。 図にするとこんな感じ。 正確には、SonarQube側にはsonar-scannerという登場人物もいて、実際の解析を行っているのは彼ですが、ココでは細かいことは割愛。 もともとJenkinsを導入済みのプロジェクトであれば、この構成でも良いと思うが、未導入の場合は無駄な構成のように感じた。 実際、私のプロジェクトもJenkinsは