Jenkins Plugin

The Jenkins plugin for Ocular allows you to automate code analysis during the build process using Ocular.

Prerequisites

This article assumes that you have installed Jenkins and have an existing Pipeline project.

Setting Up the Jenkins Plugin for Ocular

Download the sl-ocular-scan plugin and upload it to your environment.

Next, set Jenkins to run Ocular as a final build step in a Pipeline project by adding the following to your Jenkinsfile:

pipeline {
agent any
stages {
stage('Ocular Scan') {
steps {
slOcularScan(
artifact: "ARTIFACT_URL",
threadFix: false,
debug: true,
ocularArgs: "-J-Xmx4000m",
orgId: "ORG_ID",
accessToken: "ACCESS_TOKEN"
)
}
}
}
}
}

Note that slOcularScan requires several parameters; be sure to change them as appropriate during configuration:

ParameterDescription
artifactThe link to the file you want analyzed
threadFixOptional. Whether you want a ThreadFix file generated
debugOptional. Whether you want debugging information
ocularArgsOptional. Any parameters you want included in your command to run Ocular
orgIdYour ShiftLeft Organization ID. Can be found in the Dashboard under Account Settings
accessTokenYour ShiftLeft Access Token. Can be found in the Dashboard under Account Settings

Once you've configured the plugin, you can run a build to see the results.