Running Synopsys Detect in Jenkins

By default, Synopsys Detect for Jenkins downloads either the latest Detect shell script when run on a UNIX node, or PowerShell script when its un on a Windows node to the Jenkins tools directory of that node, and then executes that script. You can also use the JAR option to run Synopsys Detect.

The Detect PowerShell script or Detect shell script is downloaded once and placed in the Detect working directory. If you want to force the plugin to fetch the latest script, clear out the Detect directory in your Jenkins tools directory.

JAR option

If you do not want to download Detect, you can manually put the JAR on the node on which you want Detect to run and specify the DETECT_JAR environment variable that points to your provided JAR, and Synopsys Detect for Jenkins executes that JAR instead.

To use the JAR option do the following steps:

  1. Navigate to Dashboard > Manage Jenkins > Configure System > Global properties > Environment variables

  2. Click Add.

  3. Set an environment variable with the following properties:

    • Name: DETECT_JAR.

    • Value: <path to the Detect jar file on your Jenkins node>

When your build runs, Jenkins looks for configured environment variables, and if it locates DETECT_JAR, it uses that instead of pulling the latest Detect shell script.

Air Gap option

In Synopsys Detect version 3.1.0, Synopsys introduced the Air Gap option. If you do not want to download Detect, you can configure Air Gap from a specified Tool installation.

In freestyle and Pipeline jobs, you can toggle between the different modes for running Detect in the plugin such as pulling the Detect.jar from scripts or $DETECT_JAR_PATH, or from a specified Tool Installation.

Running Detect in a job

You can run Detect as a post-build action or a Pipeline step.

Pipeline step

You can configure the Detect scan as a Pipeline step in a Pipeline job.

Refer to the Pipeline example.

Post-build actions

You can configure the Detect scan as a post-build action in a freestyle job. You can have multiple post-build actions, but only one Synopsys Detect post-build action.

Refer to the freestyle example.

DSL considerations

The Synopsys Detect for Jenkins plugin provides Dynamic DSL for both freestyle steps and pipeline steps. Read more about Dynamic DSL at https://github.com/jenkinsci/job-dsl-plugin/wiki/Dynamic-DSL.

Note that versions 1.72 and later of the Job DSL plugin do not support the Synopsys Detect for Jenkins plugin pipeline steps.