<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sergio Flores on Medium]]></title>
        <description><![CDATA[Stories by Sergio Flores on Medium]]></description>
        <link>https://medium.com/@safloresg?source=rss-54ecf84c213b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*5H6Y_yX_a8FSFw_1wQyjvg.png</url>
            <title>Stories by Sergio Flores on Medium</title>
            <link>https://medium.com/@safloresg?source=rss-54ecf84c213b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 22:19:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@safloresg/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Gitlab-CI multi branch analysis with Sonarqube CE]]></title>
            <link>https://medium.com/@safloresg/gitlab-ci-multi-branch-analysis-with-sonarqube-ce-19212fefa316?source=rss-54ecf84c213b------2</link>
            <guid isPermaLink="false">https://medium.com/p/19212fefa316</guid>
            <category><![CDATA[sonarqube]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[gitlab]]></category>
            <dc:creator><![CDATA[Sergio Flores]]></dc:creator>
            <pubDate>Wed, 22 May 2019 23:17:40 GMT</pubDate>
            <atom:updated>2019-08-15T23:34:42.024Z</atom:updated>
            <content:encoded><![CDATA[<h3>Gitlab-CI multi branch static analysis with Sonarqube CE</h3><p>Static analysis help us finding common bugs using preconfigured static rules. It’s important that we fix this bugs before committing our changes in our master branch.</p><p>Currently, Sonarqube has removed the multi-branch analysis support from the CE, so after Sonarqube &gt;7.7 this functionality is only available in the developer edition.</p><p>However, by using the <a href="https://github.com/mc1arke/sonarqube-community-branch-plugin">sonarqube-community-branch-plugin</a> + the sonarqube API we can be able to mimic a similar behavior.</p><h4>Prerequisites</h4><p>Sonarqube CE &gt; 7.7</p><p>Gitlab CI setup</p><h4>Sonarqube server configuration</h4><ul><li>Generate an API token for your user, later we will use this token for retrieving data from the Sonarqube API.</li><li>Install the community branch plugin:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbbde68a0f942d077dcd39b958f8e987/href">https://medium.com/media/cbbde68a0f942d077dcd39b958f8e987/href</a></iframe><ul><li>Restart your Sonarqube server.</li></ul><h4>Gitlab-CI</h4><ul><li>In your .gitlab-ci.yml add the job for running the sonar-analysis:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f74a40ddd27272c1659ef3cdc93cc7f7/href">https://medium.com/media/f74a40ddd27272c1659ef3cdc93cc7f7/href</a></iframe><ul><li>In the previous job, I’m using an image that is based on the ciricihq/gitlab-sonar-scanner image, this image contains the tools that are needed for the bash script that we will use to retrieve the info of the analysis.</li><li>This <a href="https://gist.githubusercontent.com/safloresg/35b0b845eaa7b68a8d1aef266896aa39/raw/d00de2909f4cdad0f02e97b57dd714d920ea05ea/verify-sonar-branch.sh">script</a> will scan our branch vs a branch named “master”. Include it in your git project under a folder named “scripts”.</li><li>Add an environment variable that contains the sonarqube API token, because this is a sensible variable, I recommend to set the variable as “protected” under your project settings in settings &gt; CI-CD &gt;variables. The script expects a variable with the name: <strong>SONAR_TOKEN</strong></li><li>Because each time we push a new branch a Sonarqube analysis is triggered I suggest adding a cleanup job to be executed on a post-deployment stage:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/89bbdc3c1627bc51a7b13f52093b433c/href">https://medium.com/media/89bbdc3c1627bc51a7b13f52093b433c/href</a></iframe><p>Now each time a new branch is pushed to our repo, our branch will be scanned and compared vs our master branch. The job will fail if our new code doesn’t pass the quality gate.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19212fefa316" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>