Skip to main content

Screwdriver: SonarQube Enterprise Edition Support

By November 10, 2020November 1st, 2023Blog, Project

Contributed by Tiffany Kyi, Software Engineer, Verizon Media

Originally posted on screwdriver.cd

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.

In order to make use of these new Pull Request features and to better utilize our SonarQube license, we will be making the following changes:

  1. Sonar Project Key for your build will change from “job:<jobId>” to “pipeline:<pipelineId>”.
  2. 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.

These changes will enable Screwdriver to provide a Pull Request Analysis feature for all builds.

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.

User configuration

  1. 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.
  2. If you have a custom integration where you are manually constructing SonarQube scanner parameters, then you need to rely on $SD_SONAR_PROJECT_KEY & $SD_SONAR_PROJECT_NAME for scanner parameters, which will be available in builds based on your project configuration. We have also added $SD_SONAR_ENTERPRISE to indicate whether the cluster is using Enterprise (true) or open-source edition of SonarQube(false).
  3. If you absolutely need to have a separate SonarQube analysis for each job, you need to add this annotation screwdriver.cd/coverageScope: job to your job configuration in your “screwdriver.yaml” file:
jobs:
   main:
       annotations:
           screwdriver.cd/coverageScope: job
       requires: [~pr, ~commit]
       image: node:12
       steps:
           - install: npm install
           - test: npm test

Cluster Admin configuration

In order to enable SonarQube Enterprise edition with Screwdriver, do the following steps:

  1. Get a SonarQube Enterprise license.
  2. Update the SonarQube Enterprise license in the SonarQube UI (https://SONAR_URL/admin/extension/license/app).
  3. Then, set COVERAGE_SONAR_ENTERPRISE: true in your config file.

Pull Request Decoration

To set up Pull Request Decoration in your GitHub PRs, follow these steps in the link below:

https://docs.sonarqube.org/latest/analysis/pr-decoration/

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.

You should see something like this:

image of beta-screwdriver

Compatibility List

In order to have these improvements, you will need these minimum versions:

Contributors

Thanks to the following contributors for making this feature possible:

Questions and Suggestions

We’d love to hear from you. If you have any questions, please feel free to reach out here. You can also visit us on GitHub and Slack.