CloudBees action: Scan with SonarQube bundled

1 minute read
If you already are running a centralized SonarQube, use the Scan with SonarQube action instead.

If you do not have a centralized SonarQube already installed, use this action to scan a Git repository with the SonarQube static application security testing (SAST) scanner, which detects security flaws and provides suggested code fixes. SonarQube scan results are displayed in CloudBees platform analytics dashboards, but not in SonarQube reports, as the SonarQube instance is headless/ephemeral.

For code coverage information, you have to use a third-party coverage tool, as SonarQube itself does not calculate coverage. Configure the SonarQube bundled action to import coverage results by either specifying a coverage file or running a unit test.

All CloudBees action repositories are listed at CloudBees, Inc. on GitHub.

Inputs

Table 1. Input details
Input name Data type Required? Description

sonar-exclusion

String

No

SonarQube Exclusion pattern to exclude matching files.

sonar-inclusion

String

No

SonarQube Inclusion pattern to include matching files.

cover-file-name

String

No

The file path of the third-party code coverage tool results.

language

String

Yes

The language of your Git repository code base. Refer to Supported languages.

Supported languages

Table 2. Supported languages with inputs
Supported language Input format

Go

LANGUAGE_GO

Java

LANGUAGE_JAVA

JavaScript

LANGUAGE_JS

LANGUAGE_DOTNET

PHP

LANGUAGE_PHP

Python

LANGUAGE_PYTHON

Ruby

LANGUAGE_RUBY

Usage example

In your YAML file, add:

- name: Scan with SonarQube bundled uses: cloudbees-io/sonarqube-bundled-sast-scan-code@v1 with: sonar-exclusion: sonar/* cover-file-name: ./coverage.xml language: LANGUAGE_PYTHON