SonarQube Enterprise Edition Support
<p><i>Tiffany Kyi, Software Engineer, Verizon Media</i></p>
<p>We have recently added SonarQube Enterprise Edition support to Screwdriver, which unlocks powerful Pull Request Workflows and improves build analysis performance. Cluster admins can follow instructions in the Cluster Admin Configuration section below to use SonarQube Enterprise.</p>
<p>In order to make use of these new <a href="https://docs.sonarqube.org/latest/analysis/pull-request/">Pull Request features</a> and to better utilize our SonarQube license, we will be making the following changes:</p>
<ol><li>Sonar Project Key for your build will change from “job:<jobId>” to “pipeline:<pipelineId>”.</li>
<li>If your project still needs multiple analysis at job level we will provide you with a job level annotation to get a Sonar Project Key scoped to a Job.</li>
</ol><p>These changes will enable Screwdriver to provide a <a href="https://docs.sonarqube.org/latest/analysis/pull-request/">Pull Request Analysis</a> feature for all builds.<br/></p>
<p><i>Note: This will create a new Sonarqube project for your pipeline, however your existing analysis data will not be migrated over to the new Sonarqube project.</i></p>
<h2>User configuration</h2>
<ol><li>If you are relying on the Screwdriver SonarQube integration to publish and view test coverage results in the Screwdriver build detail page, then no change is required.</li>
<li>If you have a custom integration where you are manually constructing SonarQube scanner parameters, then you need to rely on <code>$SD_SONAR_PROJECT_KEY</code> & <code>$SD_SONAR_PROJECT_NAME</code> for scanner parameters, which will be available in builds based on your project configuration. We have also added <code>$SD_SONAR_ENTERPRISE</code> to indicate whether the cluster is using Enterprise (true) or open source edition of SonarQube(false).</li>
<li>If you absolutely need to have a separate SonarQube analysis for each job, you need to add this annotation <code>screwdriver.cd/coverageScope: job</code> to your job configuration in your “screwdriver.yaml” file:</li>
</ol><pre><code>jobs:
main:
annotations:
screwdriver.cd/coverageScope: job
requires: [~pr, ~commit]
image: node:12
steps:
- install: npm install
- test: npm test
</code></pre>
<h2>Cluster Admin configuration</h2>
<p>In order to enable SonarQube Enterprise edition with Screwdriver, do the following steps:</p>
<ol><li>Get a SonarQube Enterprise license.</li>
<li>Update the SonarQube Enterprise license in the SonarQube UI (https://SONAR_URL/admin/extension/license/app).</li>
<li>Then, set <code>COVERAGE_SONAR_ENTERPRISE: true</code> in <a href="https://github.com/screwdriver-cd/screwdriver/blob/master/config/custom-environment-variables.yaml#L359">your config file</a>.</li>
</ol><h2>Pull Request Decoration</h2><p>To set up Pull Request Decoration in your Github PRs, follow these steps in the link below:</p>
<p><a href="https://docs.sonarqube.org/latest/analysis/pr-decoration/">https://docs.sonarqube.org/latest/analysis/pr-decoration/</a></p><p><i>Note: Users will need to manually install the newly created Github app in their organizations and repos, and these will need to be manually configured in SonarQube projects.</i></p>
<p>You should see something like this:</p>
<figure data-orig-width="1508" data-orig-height="540" class="tmblr-full"><img src="https://64.media.tumblr.com/426d7d29a4171febe423bc58c87e8378/5782aed0099a3879-e9/s540x810/cf95527f868b20b19dd5e38945b3a39aa91f6df1.png" alt="image" data-orig-width="1508" data-orig-height="540"/></figure><p><b>Compatibility List</b></p>
<p>In order to have these improvements, you will need these minimum versions:</p>
<ul><li><a href="https://hub.docker.com/repository/docker/screwdrivercd/screwdriver">API</a> - v0.5.972</li>
<li><a href="https://hub.docker.com/repository/docker/screwdrivercd/queue-service">Queue-Service</a> - v1.0.22</li>
<li><a href="https://hub.docker.com/repository/docker/screwdrivercd/ui">UI</a> - v1.0.539</li>
<li><a href="https://hub.docker.com/repository/docker/screwdrivercd/launcher">Launcher</a> - v6.0.87</li>
<li><a href="https://hub.docker.com/repository/docker/screwdrivercd/buildcluster-queue-worker">Build Cluster Worker</a> - v1.18.8</li>
</ul><p><b>Contributors</b></p>
<p>Thanks to the following contributors for making this feature possible:</p>
<ul><li><a href="https://github.com/jithine">Jithin</a></li>
<li><a href="https://github.com/parthasl">Lakshminarasimhan</a></li>
<li><a href="https://github.com/tkyi">Tiffany</a></li>
</ul><p><b>Questions and Suggestions</b></p>
<p>We’d love to hear from you. If you have any questions, please feel free to reach out <a href="https://docs.screwdriver.cd/about/support">here</a>. You can also visit us on <a href="https://github.com/screwdriver-cd">Github</a> and <a href="https://slack.screwdriver.cd/">Slack</a>.</p>