Skip to main content

Prerequisites

Before you begin, make sure you have:
  • An existing Jenkins installation
  • A valid SCANOSS API key (required only for enterprise features)
  • Docker installed and available on your Jenkins agents
  • The following Jenkins plugins installed:
    • Docker Pipeline — runs pipeline stages inside Docker containers
    • Pipeline Utility Steps — provides file reading and utility functions
    • Generic Webhook Trigger — enables GitHub webhook-based pipeline triggers
    • Pipeline — core Jenkins pipeline support
    • GitHub Plugin — GitHub repository integration

How It Works

The SCANOSS Jenkins integration runs inside your pipeline using the official SCANOSS Docker image. The integration is capable of:
  • Cloning a GitHub repository
  • Scanning the source code with the SCANOSS CLI
  • Checking for licence compliance and undeclared components
  • Generating SBOM (Software Bill of Materials) reports in multiple formats
  • Creating Jira issues when policy violations are found
Unlike the GitLab and GitHub Actions integrations, Jenkins does not natively post inline comments to pull requests. Instead, scan results are exposed as build artefacts and, optionally, as Jira issues when policy violations occur.

Configuration

Jenkins Credentials

Credentials should be stored in the Jenkins credentials store rather than hardcoded in your pipeline. Navigate to: Dashboard → Manage Jenkins → Credentials → (select a store) → New Credential Create the following credentials:
Credential IDTypeDescription
scanoss-tokenSecret textSCANOSS API key for premium/enterprise features
gh-tokenUsername/passwordGitHub credentials for accessing private repositories
jira-credentialsUsername/passwordJira username and API token for creating issues
A Jira API token is required for Jira integration. New issues are created under the account of the user associated with those credentials. Refer to the Jira documentation for details on generating a token.

Basic Pipeline Setup

The recommended approach is to load the pipeline from a Jenkinsfile stored in the root of your repository.

Step 1: Create a New Pipeline Job

From the Jenkins Dashboard, create a new Pipeline job. jenkins-pipeline

Step 2: Configure the Pipeline Definition

In your pipeline job configuration, set:
  • Pipeline Definition: Pipeline script from SCM
  • SCM: Git
  • Repository URL: your repository URL
  • Credentials: your GitHub credentials (for private repositories)
  • Branch to build: your target branch
  • Script Path: Jenkinsfile

Step 3: Add the Jenkinsfile

Copy the SCANOSS Jenkins pipeline example from the integration repository to the root of your repository as Jenkinsfile.

Pipeline Parameters

All parameters are configured directly in the Jenkinsfile and can be overridden at build time via Build with Parameters.
ParameterDescriptionDefault
SCANOSS_CLI_DOCKER_IMAGESCANOSS CLI Docker image to use for scanningghcr.io/scanoss/scanoss-py-jenkins:v1.40.1
ABORT_ON_POLICY_FAILUREAbort the pipeline on a policy violationfalse
SCANOSS_API_URLSCANOSS API endpointhttps://api.osskb.org/scan/direct
SCANOSS_API_TOKEN_IDJenkins credential ID referencing the SCANOSS API keyscanoss-token
SKIP_SNIPPETSkip snippet generationfalse
SCANOSS_SETTINGSUse a SCANOSS settings file for scanningtrue
SETTINGS_FILE_PATHPath to the SCANOSS settings filescanoss.json
DEPENDENCY_ENABLEDEnable dependency scanningfalse
DEPENDENCY_SCOPEDependency scope to scan (prod or dev)
DEPENDENCY_SCOPE_INCLUDEComma-separated list of dependency scopes to include
DEPENDENCY_SCOPE_EXCLUDEComma-separated list of dependency scopes to exclude
LICENSES_COPYLEFT_INCLUDECopyleft licences to append to the default list (comma-separated)
LICENSES_COPYLEFT_EXCLUDECopyleft licences to remove from the default list (comma-separated)
LICENSES_COPYLEFT_EXPLICITExplicit list of copyleft licences to use, replacing the default (comma-separated)
CREATE_JIRA_ISSUEEnable automatic Jira issue creation on policy violationfalse
JIRA_URLJira instance URL
JIRA_PROJECT_KEYJira project key (e.g. PROJ)
JIRA_CREDENTIALSJenkins credential ID for Jira (username + API token)jira-credentials
DEBUGEnable debug loggingfalse
DEPENDENCY_SCOPE, DEPENDENCY_SCOPE_INCLUDE, and DEPENDENCY_SCOPE_EXCLUDE are mutually exclusive. Use DEPENDENCY_SCOPE for a single scope, or DEPENDENCY_SCOPE_INCLUDE/DEPENDENCY_SCOPE_EXCLUDE for fine-grained control.

Policy Checks

The SCANOSS Jenkins integration supports two configurable policy checks:
  • Copyleft (copyleftPolicyCheck) — Detects components or code snippets associated with copyleft licences. If detected, the build is marked UNSTABLE. The default copyleft licence list can be customised using the LICENSES_COPYLEFT_INCLUDE, LICENSES_COPYLEFT_EXCLUDE, or LICENSES_COPYLEFT_EXPLICIT parameters.
  • Undeclared (undeclaredComponentsPolicyCheck) — Compares detected components against those declared in your scanoss.json file. If undeclared components are found, the build is marked UNSTABLE.
By default, policy violations mark the build as UNSTABLE rather than FAILED. Set ABORT_ON_POLICY_FAILURE to true to fail the build outright on any policy violation.
When policy violations are detected and Jira integration is enabled, a Jira issue of type Bug is automatically created containing the full policy report and a link to the Jenkins build. jenkins-jira-undeclared jenkins-copyleft

GitHub Webhook Trigger

A GitHub webhook automatically triggers the pipeline whenever code is pushed to the repository.

1. Configure Jenkins Pipeline

  1. Navigate to Dashboard → your pipeline → Configure
  2. In the Build Triggers section, select Generic Webhook Trigger
  3. Copy the Jenkins webhook URL shown
jenkins-configure-pipeline

2. Configure Webhook Parameters

Under Post content parameters, add:
  • Variable name: payload
  • Value: $
  • Expression type: JSONPath
Configure the trigger token by appending it to your Jenkins webhook URL:
http://JENKINS_URL/generic-webhook-trigger/invoke?token=YOUR_TOKEN
jenkins-webhook-parameter

3. Configure GitHub

Add the Jenkins webhook URL in your GitHub repository under Settings → Webhooks. Refer to the GitHub webhook documentation for full setup instructions. jenkins-gh-webhook
For private GitHub repositories, configure GitHub credentials in your pipeline using the gh-token credential. Refer to GitHub’s personal access token documentation for details.
jenkins-private-repo

Multibranch Pipeline

For repositories with multiple branches, use a Multibranch Pipeline to automatically detect and build all branches containing a Jenkinsfile.

Setup Steps

  1. From the Jenkins Dashboard, create a new Multibranch Pipeline jenkins-multibranch-selection
  2. Under Branch Sources, add your repository URL and credentials jenkins-multibranch-credentials
  3. Select your desired pipeline behaviours (branch discovery strategy, build triggers) jenkins-multibranch-behaviours
  4. Under Build Configuration, set:
    • Mode: by Jenkinsfile
    • Script Path: Jenkinsfile
    jenkins-multibranch-build-config
  5. Apply and save

SCANOSS Policy Check Reports

SCANOSS generates policy check reports that are uploaded to the Jenkins build artefacts and, when Jira integration is enabled, attached to the corresponding Jira issue.

Default Reports

The following report is always generated for every pipeline run:
  • results.json — Complete raw scan results from the SCANOSS API

Conditional Reports

The following reports are generated only when their respective policy checks detect violations:
  • scanoss-copyleft-report.md — Generated when copyleft licences are detected
  • scanoss-undeclared-components-report.md — Generated when undeclared components are found

Artefacts

Scan results and policy check reports are uploaded to the Jenkins build artefacts for every run. To access them, navigate to your build in Jenkins and open the Artefacts section.
ArtefactDescription
results.jsonRaw scan results from the SCANOSS API containing detailed component and snippet match information
scanoss-copyleft-report.mdCopyleft policy check report in Markdown format (generated only when violations are found)
scanoss-undeclared-components-report.mdUndeclared components policy check report in Markdown format (generated only when violations are found)
scanoss-cyclonedx.jsonCycloneDX 1.4 SBOM
scanoss-spdx.jsonSPDXLite 2.2 SBOM
scanoss-sbom.csvSBOM in CSV format
jenkins-artifacts